-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DefaultUserModifyCrudRepository not setting properly created_by #84
Comments
Hi @dkmanolov, If I understood it correctly, your issue is that you are not getting the current user_tenant id as uuid in CurrentUser? For that you would have to change the Tenant model, and make appropriate changes in the DB accordingly, if you are getting any issues doing that, please share them here, preferably with a screenshot of any error you are facing. After doing all this, you would still need to generate a new token to get the changes in the CurrentUser binding. |
Hi @akshatdubeysf, thank's for your reply. I'll try to provide more detail info about the case. When I debug, I saw that in
And if I console log currentUser.id shows the id from the users table. I don't think this is related to the uuid transition, I've noticed it then because when I've tested with just single user and signle row in user_tenants they both have id of 1, but with uuid every id is unique and the error appear. |
Thanks for you detailed response, it is indeed an issue, I'll try and raise a PR to fix this as soon as possible. |
No problem thank you for your time! My quick fix was to extend the AuthUser model with userTenantId and use it later where needed (in the DefaultUserModifyCrudRepository).
|
DefaultUserModifyCrudRepository gets CurrentUser.id and pass it to entity.createdBy.
I've migrated the project to use uuid isntead of id and noticed that currentUser.id returns the user id but not the user_tenant id.
And when creating the tables in the migrations we have relation between created_by and user_tenants id, then I'm having constraint fail.
I've added userTenantId in the AuthUser model but I'm not sure if I'm wrong or there is really a bug?
Any help is appreciated, thanks!
The text was updated successfully, but these errors were encountered: