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

Prisma2: Type missing for create #436

Closed
nicosampler opened this issue Oct 2, 2019 · 2 comments
Closed

Prisma2: Type missing for create #436

nicosampler opened this issue Oct 2, 2019 · 2 comments
Assignees
Labels
note/duplicate This issue existed already scope/projecting Exposing Prisma Models in the GQL API type/feat Add a new capability or enhance an existing one

Comments

@nicosampler
Copy link

Defining an schema like this one:

model User {
  id       String  @default(cuid()) @id
  username String  @unique 
}

model Client {
  id           String     @default(cuid()) @id
  name         String
  email        String     @unique
  createdBy User
}

there is no generated type for ClientCreateOneInput, but there are types for ClientCreateOneWithoutClientInput ClientCreateWithoutCreatedByInput.

Photon does generate ClientCreateOneInput , but Nexus does not. I think is important to have the full type here. For example, I can not create a custom resolver like this one because of the lack of that type.

export const UserMutations = extendType({
    type: 'Mutation',
    definition: t => {
        t.field('createClient', {
            type: 'Client',
            args: {
                data: arg({ type: 'ClientCreateInput' }),
            },
            resolve: (_, args, ctx) => {
                return ctx.photon.clients.create({
                    data: {
                        ...args,
                        createdBy: {
                            connect: { id: ctx.userInfo.id },
                        },
                    },
                })
            },
        })
    },
})
@tgriesser tgriesser transferred this issue from graphql-nexus/nexus Oct 2, 2019
@iherger
Copy link

iherger commented Oct 3, 2019

Related to #381

@jasonkuhrt jasonkuhrt added scope/projecting Exposing Prisma Models in the GQL API type/feat Add a new capability or enhance an existing one labels Oct 5, 2019
@jasonkuhrt jasonkuhrt added this to Backlog in Labs Team via automation Oct 5, 2019
@jasonkuhrt jasonkuhrt moved this from Backlog to Sprint in Labs Team Oct 7, 2019
@jasonkuhrt jasonkuhrt added needs/investigation Possibly an issue, needs more analysis/research and removed type/feat Add a new capability or enhance an existing one labels Oct 7, 2019
@jasonkuhrt jasonkuhrt moved this from Sprint to In Progress in Labs Team Oct 9, 2019
@jasonkuhrt jasonkuhrt self-assigned this Oct 9, 2019
@jasonkuhrt
Copy link
Contributor

Hey @nicosampler this is a duplicate of #381 I think. Adding you're +1 to this. Thanks!

@jasonkuhrt jasonkuhrt added note/duplicate This issue existed already type/feat Add a new capability or enhance an existing one and removed needs/investigation Possibly an issue, needs more analysis/research labels Oct 9, 2019
Labs Team automation moved this from In Progress to Shipped Oct 9, 2019
@jasonkuhrt jasonkuhrt removed this from Shipped in Labs Team Mar 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
note/duplicate This issue existed already scope/projecting Exposing Prisma Models in the GQL API type/feat Add a new capability or enhance an existing one
Projects
None yet
Development

No branches or pull requests

3 participants