Shaul Zuarets
02/03/2022, 8:00 PMwhere
clause and with the proper tenant ID - I’ve added a Prisma middleware for that.
I’ve wrote (me and @yakirgot) a new npm package for all of it here, and the code is here.
I have two questions:
1. in different languages, I used to work with database hooks or scope to get this functionality and I wonder if middleware is the right approach in prisma. Am I missing anything?
2. My where
clause validation is pretty simple and straightforward, I would love to get your opinion on it.
PS, you are all more than welcome to contribute, there is still much work needed :)
Thanks in advance,
ShaulAlex Vilchis
02/03/2022, 9:31 PMAlex Vilchis
02/03/2022, 9:42 PMUser
model has an organizationId
field and also a posts
. We don't need to relate Post
directly to Organization
because User
already has that information.
I've struggled with the idea of adding organizationId / tenantId to every table, seems kind of repetitive, doesn't it? 🤔Shaul Zuarets
02/04/2022, 7:39 AM