nexus-plugin-prisma
nexus-plugin-prisma copied to clipboard
Use Prisma Type as arg
kind of similar to graphql-nexus/nexus#69 but there where some major changes since then so I don't know if commenting on this issue makes sense.
My question:
Is it possible to use a type from the Prisma
namespace as argument type like:
t.field("createCompany", {
type: "Company",
args: {
secret: nonNull(stringArg()), // SOME OTHER ARGS
data: arg({ type: Prisma.CompanyCreateInput }), // USE PRISMA TYPE AS ARG
},
async resolve( _root, args, ctx ) {
//... logic
}
});
the error states that Property 'CompanyCreateInput' does not exist on type 'typeof Prisma'
but the type CompanyCreateInput
is definitely exported in the index.d.ts
of .prisma/client
.
I have similar question, but not quite. I am fine being able to access them through a string, my only issue is that there aren't enough field types available.
For example, only the ModelWhereUniqueInput
is generated, but not ModelWhereInput
, which would allow me to implement a custom "where" field without the need to create a custom Input and miss out on the advanced filtering.
I think at least all aggregate fields (from ModelAggregateArgs
) should be generated.
Any Update on this issue?