You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My understanding is that I should create a ModelService to support a ModelController in fulfilling requests. This is understandable and easy, but I can't figure out how to get to the user object, or request, or controller, from the ModelService. There is discussion about RouterContext, but that is also not available in the ModelService.
If I create the endpoint in the controller then I can do it, but it seems like the architecture encourages me to implement the CRUD in the ModelService, which means I need to filter there (unless I am out to lunch)
My use case is to limit the queryset to instances that belong to the user, for example.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
My understanding is that I should create a ModelService to support a ModelController in fulfilling requests. This is understandable and easy, but I can't figure out how to get to the user object, or request, or controller, from the ModelService. There is discussion about RouterContext, but that is also not available in the ModelService.
If I create the endpoint in the controller then I can do it, but it seems like the architecture encourages me to implement the CRUD in the ModelService, which means I need to filter there (unless I am out to lunch)
My use case is to limit the queryset to instances that belong to the user, for example.
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions