-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Context criteria and attributes are always empty objects #53
Comments
@bradisbell all query items should be converted to search criteria in list: https://github.com/dchester/epilogue/blob/master/lib/Controllers/list.js#L88. There's actually a test that shows this off in particular: https://github.com/dchester/epilogue/blob/master/tests/resource/associations.test.js#L218. As you can see, for the list controller the criteria is built up as part of the fetch milestone so that might be the issue you are running into. I'm up or a discussion about how that preparation should happen earlier in the chain, if you have a proposal. |
@mbroadst I'm not seeing anything in |
@bradisbell let's take the ListController for example here:
In your provided example if you added something to context.criteria in e.g. the "start" milestone, you would see it in your traces:
So basically what I'm getting at is: this might not be the best behavior. Maybe we should pull off the criteria much earlier as a default milestone for these controllers (e.g. we move this to List.prototype.start or something). But we need to discuss it a bit first because these behavior changes, while undocumented, are depended upon by existing users |
I think I understand what you are saying. The |
@bradisbell context.criteria is used in that milestone to modify the query parameters, so in that way yes context.criteria is "for modification." However, I guess I'm pointing out that there is what might considered a bug here because the context.criteria is never updated in the milestone, so you wouldn't see any additional data in subsequent milestones. I'm not sure if I'm even answering your question anymore 😄 |
@bradisbell have we answered your question here? |
I think so. At this point I have just written my own middleware for the specific routes that need the functionality I need. Thanks for the reply and explanation. |
I am trying to figure out how to authenticate a request based on what Epilogue has determined the criteria are. I thought it would make sense to use the hooks and milestones for that.
The
context
object hascriteria
andattributes
properties. While their functionality isn't documented,criteria
is used in one of the code examples. I'm assuming that one of them is supposed to contain any query criteria as parsed from the request.If I pass in a request for
/streams?AccountId=1
(whereAccountId
is actually for an association to anAccount
model), I was hoping to be able to access this somewhere as Epilogue would use it in a query. While it is possible for me to pull this out of the query string onreq
myself, if I can validate the criteria Epilogue uses in its own query, I believe that would be a more reliable and secure implementation.Is this possible today?
The text was updated successfully, but these errors were encountered: