Nexus-Prisma question: I have a type `Address` in...
# orm-help
a
Nexus-Prisma question: I have a type
Address
in my data model with fields
streetName
and
houseNumber
I want to only expose streetName when a non-authenticated user tries to query a resolver that returns my the Address type and all fields when the user is authenticated. How would I do that using nexus-prisma?
k
You might want to look into using GraphQL Shield for managing your permissions. https://github.com/maticzav/graphql-shield
a
I am already using GraphQL Shield for complete queries.
But how would I use it on field specific level?
k
I hope I’m not confusing things here, as I don’t have too much experience with GraphQL Shield myself, but it seems to be fairly straightforward to attach rules to fields of types. https://gist.github.com/maticzav/d96325eff2e96a8c3864e3b950345c08#file-shield-yoga-ts-L17 (Gist taken from this article https://medium.com/@maticzav/graphql-shield-9d1e02520e35)
💯 1
a
I think you are right! For some reason I assumed that the rules could only be applied to Query and Mutation. 🤷‍♂️
🙌 1
Thanks @kuldar it worked out! 🙂
🦜 2