Skip to content
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

Use Prisma Type as arg #1030

Open
chrishoermann opened this issue Jan 21, 2021 · 2 comments
Open

Use Prisma Type as arg #1030

chrishoermann opened this issue Jan 21, 2021 · 2 comments

Comments

@chrishoermann
Copy link

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.

@tgriesser tgriesser transferred this issue from graphql-nexus/nexus Jan 21, 2021
@fnky
Copy link

fnky commented Feb 19, 2021

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.

@durga14341
Copy link

Any Update on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants