Skip to content

Permission checks on 1:1 relations in prisma plugin #1317

Answered by hayes
m1212e asked this question in Q&A
Discussion options

You must be logged in to vote

I see. Unfortunately if it's not supported in Prisma there isn't anything we can do in Pothos in t.relation.

The queries are computed before data is resolved/queried from the db.

There are 2 options here, each with their own drawbacks:

You can use the auth plugin and add an auth check to the field. This would be enforced before the resolver runs, but the data will already be fetched from the db. It prevents it from being returned in the query, but not from being queried from the db

The other option is to replace t.relation with t.prismaField and load the conference with a prisma.conference.findUniqie call, and add your where clause there.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@m1212e
Comment options

@hayes
Comment options

Answer selected by m1212e
@m1212e
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants