Auto add specific fields-values to create & update queries #517
Replies: 4 comments 2 replies
-
I even tried this but it throws below typescript error
|
Beta Was this translation helpful? Give feedback.
-
This is actually a very interesting request! I had a very similar case at work recently, and went with an obvious decision: simply added updatedBy to every update query I could find across the codebase for the table. I don't have a clear solution for this right now, but that's a good case to think about, to come up with a clear solution. I'm seeing the solution as:
I'll try to code a simple prototype and to add it to the docs to serve as an example. |
Beta Was this translation helpful? Give feedback.
-
There is a interesting case that needs to be handled. createdBy shouldnt be editble. |
Beta Was this translation helpful? Give feedback.
-
The approach as you shared. If it could be that simple, it would be great. No push on the urgency though but I am happy to contribute it. If we can do something incrementally that would be great. I also feel that we can bring some module/approach which loads the metadata/context for every query. This approach will solve issues for multi-tenancy, RLS & Audit-trailing all together. If this context is available in hooks, will help solve multiple things together. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have fields createdByUserId & updatedByUserId. I want to auto add them to every create and update query as the case may be. What would be the best way to do this?
I was searching for some kind of query builder pattern for create and update but couldn't find anything, any direction would be great. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions