'How to filter data in Loopback 4 with Auth plugin
Hi I'm quite new with loopback in general, so this question might be obvious.
I've followed this guide: https://mobilediana.medium.com/using-postgresql-with-loopback4-jwt-authentication-extension-d956ac707746 to install loopback4 with JWT plugin for auth. Everything went smoothly. I was able to login and the register process is working without any issues.
Now I have a requirement to create a new table account and the user should only see the account associated with his own user. I was thinking of making a relationship from the account to the user and then I could filter the query via the user id. However when I try to make a relationship from/to the user I'm confronted with an error on the CLI that the repo does not exist.
"Generation is aborted: Error: UserRepository class does not exist. Please create a repository first with "lb4 repository" command."
Well the solution seems quite obvious, I should just type the lb4 repository, create the repo and that's it. Well, the problem is that if I create a new repo for the user the JWT plugin stops working because my user repo overrides the ones from the plugin and well things break...
Maybe I've missed something but I don't find any information on how to achieve this. My repo here: https://github.com/jgomes94/kickstart-loopback-react.git
Any help or even an example repo where this is achieved would be very helpful. Thank you
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
