You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I use CASL to filter my prisma queries based on what a user can do. I use pothos and the generator to create all objects and queries which I want to have. My object definitions look something like this:
builder.prismaObject('Conference',{fields: (t)=>({id: t.field(ConferenceIdFieldObject),title: t.field(ConferenceTitleFieldObject),longTitle: t.field(ConferenceLongTitleFieldObject),delegations: t.relation('delegations',{query: (_args,ctx)=>({// this basically just adds a where condition to the query// where: ctx.permissions.allowDatabaseAccessTo('read').Delegation})}),
...
I simply inject the where condition into the relation field and it would be super cool to make the generator do this automatically where applicable. Could you imagine some way this could work?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, I use CASL to filter my prisma queries based on what a user can do. I use pothos and the generator to create all objects and queries which I want to have. My object definitions look something like this:
I simply inject the where condition into the relation field and it would be super cool to make the generator do this automatically where applicable. Could you imagine some way this could work?
Beta Was this translation helpful? Give feedback.
All reactions