noynek2242
Explore posts from serversPPrisma
•Created by noynek2242 on 9/11/2024 in #help-and-questions
Row Level Security Example
I'm playing with this example on client extension and row-level-security (RLS). The thing that's got me confused is the example gets a user just by grabbing the first item
I'm using next-auth and I can't figure out how to get the signed-in user from here. Any suggestions?
https://github.com/prisma/prisma-client-extensions/blob/main/row-level-security/script.ts#L42
2 replies
PPrisma
•Created by noynek2242 on 8/15/2024 in #help-and-questions
Multi-tenant approaches
I'm trying to figure out a multi-tenant approach and it's really confusing. I prefer to use a single postgresql DB and the RLS functionality looks ideal, but it also looks like it doesn't work with Prisma.
This library was recently put into read-only
https://github.com/Errorname/prisma-multi-tenant
The Zenstack approach looks nice, but it adds a pretty big library and I haven't done enough research to know what I'm taking on.
https://zenstack.dev/docs/the-complete-guide/part1/access-policy/
I'm also trying to figure out how well this works. I can't tell if it's just a prototype or if it's a stable approach
https://github.com/prisma/prisma-client-extensions/tree/main/row-level-security
Any suggestions? thanks
4 replies
TTCTheo's Typesafe Cult
•Created by noynek2242 on 3/8/2024 in #questions
Decimal Warning
I'm trying to figure out this error:
Warning: Only plain objects can be passed to Client Components from Server Components. Decimal objects are not supported.I have some prisma decimals so I tried some of the fixes to the superjson transformer using Decimal.js, but it didn't make the warnings go away. I haven't run into an actual problem yet though so I'm confused. Any suggestions? thanks
3 replies
TTCTheo's Typesafe Cult
•Created by noynek2242 on 2/24/2024 in #questions
Sharing Logic Across TRPC Procedures
I've got multiple procedures that need to share logic. For example, I've got a query and a mutation that both return a
lastUpdatedBy
field. Instead of returning the user id, I return their name.
Technically, I've been able to write the code within both the query and mutation, but I'm struggling to find a way to share that logic.
The main issue is really a Typescript one where I can't figure out how to
The challenge I'm stuck on is figuring out the types in my util. I was able to get the prisma types, but not the something
types.
I've tried this approach https://trpc.io/docs/client/vanilla/infer-types with something like
But that produces an error
'something' is referenced directly or indirectly in its own type annotation.Any suggestions? thanks!
3 replies
TTCTheo's Typesafe Cult
•Created by noynek2242 on 2/21/2024 in #questions
Client/Server Mutations
Hey, I'm trying to wrap my head around client vs server components in my app. Here's the basic structure I'm using:
This approach works well for returning the data in a clean and fast way while allowing for interactivity in the form. Where I'm getting lost is how to submit the form. I can submit it client side with the
useMutate
hook, but then I'm not sure how to fetch new data.
It seems more ideal to use the server mutate
function instead, but I can't figure out how to call that from a client component.
I can make this all work with client components, but it seems like the direction of the App router in Next.js is to move toward server components.
Thanks7 replies