Closed leoDreamer closed 3 years ago
@leoDreamer You can generate your CRUD just one time with my CLI and update it.
Don't forget if you rerun; the CLI will replace your work
@AhmedElywa thanks reply. because of rerun will replace my custom code, I couldn't update the generated CRUD, there are any plan to support nexus-plugin-prisma
option in CLI
Can you suggest how we can support this option? Thanks
How about this, in CLI option define like
customResolverByModel: {[modelName: string]: {[fieldName: string]: function}[]}
use like
customResolverByModel: {
User: [
{ findOne: async function(root, args, ctx, info, originalResolve) {...} },
// or
{ findMany: require(path.join(process.cwd(),'src/resovler/user')).findMany },
]
}
write the fieldName's value to the generated code as nexus-plugin-prisma's option
Yes, this can be an option, but I will take the function as a string like this.
customResolverByModel: {
User: [
{ findOne: `async function(root, args, ctx, info, originalResolve) {...}`},
]
}
because we print this code in your files, not use as a function
Thanks a lot,look forward to this feature publish.
@leoDreamer when I was working on this. I said we already have a nexus
generator that generates native nexus types without using nexus-plugin-prisma
.
If you need to customize everything, why use nexus-plugin-prisma
instead of nexus
generator.
Can you give this a try?.
Hi, in![image](https://user-images.githubusercontent.com/16728066/99641753-a9a34a80-2a85-11eb-80c5-c5bf8dddc138.png)
nexus-plugin-prisma
options, we can replace the default resolve,there are any solution to use custom resolver in somet.crud