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:
@CreatedBy
private User user;
@CreatedDate
private DateTime createdDate;
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?