-
Notifications
You must be signed in to change notification settings - Fork 274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hiding certain fields #216
Comments
There is a solution now in the form of configuring so-called root types. Take a look here https://nexus.js.org/docs/type-generation#root-types. I think we should treat this issue as a discussion about having a backing types DSL, which would be a new feature. |
I found and solved by the And the issue of |
from objectType.d.ts in nexus Prisma source /**
* Pick, filter or customize the fields of the underlying object type
* @param inputFields The fields you want to pick/filter/customize
*
* @example Exposes all fields
*
* t.prismaField(['*'])
*
* @example Exposes only the `id` and `name` field
*
* t.prismaField(['id', 'name'])
*
* @example Exposes only the `id` and `name` field (idem-potent with above example)
*
* t.prismaFields({ pick: ['id', 'name'] })
*
* @example Exposes all fields but the `id` and `name`
*
* t.prismaFields({ filter: ['id', 'name'] })
*
* @example Exposes the only the `users` field, and alias it to `customers`
*
* t.prismaFields([{ name: 'users', alias: 'customers' }])
*
* @example Exposes only the `users` field, and only the `first` and `last` args
*
* t.prismaFields([{ name: 'users', args: ['first', 'last'] }])
*
*/
prismaFields(inputFields: AddFieldInput<'objectTypes', TypeName>): void; For those looking to hide fields in resolvers The Prisma api supports |
Hello. I wanted to discuss a new feature and created an issue.
Currently Nexus seems to be optimized for creating schema following the table model in the DB. But, I want to hide certain fields in table to users.
I'll briefly explain it through code.
If I want to hide
imageId
inUser
type,There is a TypeError when get property from
parent
although the property exist.So I want to discuss some new features that can hide certain fields.
I'll briefly explain it through code.
And we can safely get
parent.imageId
. And also, can hide certain fields that users should not know.If there is a solution that can solve this problem, please let me know.
The text was updated successfully, but these errors were encountered: