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
There are a lot of endpoints in this API that need the clan_id of the user that made the request. Current way has been to inject the player service to the service that handles the incoming request and then query the db with the player_id provided in the request context and LoggedUser decorator. This adds a lot of repeated code and makes it necessary to inject player service to several other services that might only need it for the clan_id.
My suggestion would be that the AuthGuard would attach the clan_id to the request context if a @GetClanID() decorator is added to the controller or a specific endpoint. In my opinion this would simplify the process of getting the clan id and it would always be handled in the same place.
How do you think this should work?
Add GetClanId decorator that sets metadata SetMetadata(GET_CLAN_ID, true)
Inject Player service to the auth guard.
Add to AuthGuard reflector.getAllAndOverride(GET_CLAN_ID) and if its found then call the playerService with user.player_id from jwt token and attach the found clan_id to the request context
Add optional clan_id to the User class
Any additional info?
This should be easy replacement for the existing services that call the playerService for clan_id when refactoring the services and easier option to implemet into new services and endpoints.
The text was updated successfully, but these errors were encountered:
What do you want to see in the API?
There are a lot of endpoints in this API that need the clan_id of the user that made the request. Current way has been to inject the player service to the service that handles the incoming request and then query the db with the player_id provided in the request context and LoggedUser decorator. This adds a lot of repeated code and makes it necessary to inject player service to several other services that might only need it for the clan_id.
My suggestion would be that the AuthGuard would attach the clan_id to the request context if a @GetClanID() decorator is added to the controller or a specific endpoint. In my opinion this would simplify the process of getting the clan id and it would always be handled in the same place.
How do you think this should work?
SetMetadata(GET_CLAN_ID, true)
reflector.getAllAndOverride(GET_CLAN_ID)
and if its found then call the playerService with user.player_id from jwt token and attach the found clan_id to the request contextAny additional info?
This should be easy replacement for the existing services that call the playerService for clan_id when refactoring the services and easier option to implemet into new services and endpoints.
The text was updated successfully, but these errors were encountered: