Anton
Anton
PPrisma
Created by Anton on 5/21/2024 in #help-and-questions
Pass current user id to Postgres
One idea is to use JS Reflections to proxy the calls being made to Prisma, thereby adding the possibility to intervene and add the behaviour of passing down a user to Postgres. But that comes with some complexity as well.
6 replies
PPrisma
Created by Anton on 5/21/2024 in #help-and-questions
Pass current user id to Postgres
I'd also like to avoid having each call to a PrismaClient method have to pass down the user. I guess this should be possible by extending Prisma but it's not really desirable as it will add complexity to many other parts of the application.
6 replies
PPrisma
Created by Anton on 5/21/2024 in #help-and-questions
Pass current user id to Postgres
I guess that's what we need to do somehow, make the Prisma middleware/extension fetch the current user id during runtime. The question is how to do that in practice. We have the current user available in the HTTP request context but the PrismaClient would live as a singleton outside that context. It's challenging 🤔
6 replies