dka 🐻⛓ A6K3R-CFAC
dka 🐻⛓ A6K3R-CFAC
PPrisma
Created by dka 🐻⛓ A6K3R-CFAC on 8/19/2024 in #help-and-questions
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.idin 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;
@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?
1 replies
PPrisma
Created by dka 🐻⛓ A6K3R-CFAC on 7/4/2024 in #help-and-questions
yarn 4
Does yarn prisma generate works with yarn 4 ? If so, how ?
2 replies
PPrisma
Created by dka 🐻⛓ A6K3R-CFAC on 7/4/2024 in #help-and-questions
Cannot generate prisma client in monorepo
I am in the middle of upgrade to yarn v1 to yarn v4 as I was struggling with the linking of dependency using lerna v1. Since, I am unable to generate my prisma client, and the erreor is very (very) broad. I have been following all the advices from GitHub to the discord bot here. I have already created a new project and move my code little by little, this is kind of a dead end for me and my project. Can anyone enlight me about that error ? Thanks
prisma:generator prismaCLIDir undefined +16083ms
prisma:generator prismaClientDir undefined +0ms
Error: Error: Could not resolve @prisma/client despite the installation that we just tried.
Please try to install it by hand with yarn add @prisma/client and rerun yarn dlx "prisma generate" 🙏.
at Object.Fse [as prisma-client-js] (/private/var/folders/kr/zw6gf805145bj7ggnw_cbvkh0000gn/T/xfs-21152927/dlx-20813/.yarn/unplugged/prisma-npm-5.16.1-d98cf1849b/node_modules/prisma/build/index.js:414:4463)
at async Qo.e.stopOnError (/private/var/folders/kr/zw6gf805145bj7ggnw_cbvkh0000gn/T/xfs-21152927/dlx-20813/.yarn/unplugged/prisma-npm-5.16.1-d98cf1849b/node_modules/prisma/build/index.js:420:1905)
at async /private/var/folders/kr/zw6gf805145bj7ggnw_cbvkh0000gn/T/xfs-21152927/dlx-20813/.yarn/unplugged/prisma-npm-5.16.1-d98cf1849b/node_modules/prisma/build/index.js:19:752
prisma:generator prismaCLIDir undefined +16083ms
prisma:generator prismaClientDir undefined +0ms
Error: Error: Could not resolve @prisma/client despite the installation that we just tried.
Please try to install it by hand with yarn add @prisma/client and rerun yarn dlx "prisma generate" 🙏.
at Object.Fse [as prisma-client-js] (/private/var/folders/kr/zw6gf805145bj7ggnw_cbvkh0000gn/T/xfs-21152927/dlx-20813/.yarn/unplugged/prisma-npm-5.16.1-d98cf1849b/node_modules/prisma/build/index.js:414:4463)
at async Qo.e.stopOnError (/private/var/folders/kr/zw6gf805145bj7ggnw_cbvkh0000gn/T/xfs-21152927/dlx-20813/.yarn/unplugged/prisma-npm-5.16.1-d98cf1849b/node_modules/prisma/build/index.js:420:1905)
at async /private/var/folders/kr/zw6gf805145bj7ggnw_cbvkh0000gn/T/xfs-21152927/dlx-20813/.yarn/unplugged/prisma-npm-5.16.1-d98cf1849b/node_modules/prisma/build/index.js:19:752
2 replies