avia icon indicating copy to clipboard operation
avia copied to clipboard

Database call in every API request

Open arjun289 opened this issue 5 years ago • 0 comments

At present, every time Guardian is used for token verification, a repo call is made to pull out user from the database: See SnitchApi.Guardian.resource_from_claims/1 This is not required for all the API calls as user data is not required every time.

We can move the loading user data from the database to load user plug. See SnitchApiWeb.Plug.LoadUser

This plug is already being used specifically in those particular controllers where user data is needed.

arjun289 avatar Nov 12 '19 03:11 arjun289