How to have @createdBy and @updatedBy annotation in prisma schema (like @updatedAt)
In a nestjs and prisma api, I would like to add audit columns to my database.
Writting the mapping to get the
user.id
in each create/update method of each of my entities is cumbursome. In spring data rest, this is how they do auditing:
In prisma for example, I can use @updatedAt
annotation in my schema to have the updatedData columns without writing code.
I would like to have @createdBy
and @updatedBy
audit annotation, either in prisma or in my nestJS code to audit the connected user.id who made the creation or modification of a row.
How is this possible?0 Replies