Closed andrei9669 closed 3 years ago
The user
you got in @CrudAuth
is defined by your self, usually in an AuthGuard
, so just simply ensure the user
you defined on the request has the client relation loaded.
oh yeah, I could just load all necessary data in AuthGuard, why didn't I think about that, thanks. altho, in authguard I get the user data from JWT token. would it be reasonable to do full user request every time someone does a request? cus most of the time, that data wouldn't be needed.
oh yeah, I could just load all necessary data in AuthGuard, why didn't I think about that, thanks. altho, in authguard I get the user data from JWT token. would it be reasonable to do full user request every time someone does a request? cus most of the time, that data wouldn't be needed.
Querying the user
is inevitable, but the relations of the user
entity have no need to be loaded every time. The token must be validated by trying to query the user
entity from the database, isn't it?
well yea, right now I use a guard that checks if jwt is valid, that doesn't require querying database, but I guess In the future I will need to check if the user is banned or not, which would require querying relations. I guess I will just query the required data in its own endpoint.
in the @CrudAuth() only thing that I get, and is usable, is id. How could I filter sensors based on what clients the user has?
I'm doing the request to the sensor table.