prisma / codemods

A Collection of Codemods for Prisma 2
https://www.prisma.io/docs/guides/upgrade-guides/upgrading-versions/codemods
34 stars 3 forks source link

Nexus Schema functions not inspected. #7

Closed danhollick closed 3 years ago

danhollick commented 3 years ago

It seems like the codemod doesn't inspect @nexus/schema functions like mutationField(). For example the following code is not converted from findOne to findUnique:

export const login = mutationField('login', {
  type: 'User',
  args: {
    email: stringArg({ required: true }),
    password: stringArg({ required: true }),
  },
  async resolve(parent, { email, password }, context) {
    const user = await context.prisma.user.findOne({
      where: { email },
    })
    return user
})

Code outside of those functions is converted.

All of these files contain mutationField() and most of them required converting. Screenshot 2020-11-25 at 09 19 42

williamluke4 commented 3 years ago

@danhollick Yes, this is not supported currently. Will see what I can do

williamluke4 commented 3 years ago

@danhollick Could you check if 0.6.1 fixes this for you :)

williamluke4 commented 3 years ago

Feel free to reopen if it is not fixed

danhollick commented 3 years ago

@williamluke4 there is currently a bug using @nexus/schema with prisma client 2.12.0 so I'll need to wait until that's patched before I can test again.

janpio commented 3 years ago

What bug are you referring to? Does an issue for this exist @danhollick?

danhollick commented 3 years ago

@janpio I think it was fixed already. Might have just been a dependency bump: https://github.com/graphql-nexus/nexus-plugin-prisma/issues/959