Closed kuksik closed 3 years ago
@kuksik, Thanks for your issue. It explains a good idea.
we can make an object have your customization for all models like
{
User: ['id', 'name'],
Type: ['id', 'descriptionRaw'],
Post: ['id', 'body'],
}
and you can pass it to PrismaSelect class, and when every time we need to select this model, we look to this schema and add default fields in your custom object
I will start on this feature now. wait new release
@AhmedElywa cool! I thought about the same approach. Can i help with something?
I changed my approach. it will be like
const defaultFields = {
User: { id: true, name: true },
Type: { id: true, descriptionRaw: true },
Post: { id: true, body: true },
}
Please try version 1.5.0
Whether it exists common approach how to add default fields to the entities? I have implemented something like:
`
schema.prisma
`
`
resolvers.ts
` It works but looks very mass in case of complex schema. What to do if you need (for some reasons) id field for every entity? Do we need describe "type" select in every resolver? Will be cool have some approach which allow do reduce code and avoid repeats.