How do I set args on Query in Prisma using Nexus? ...
# orm-help
a
How do I set args on Query in Prisma using Nexus? I've cloned this starter kit → https://github.com/ntlf/graphql-starter which uses Prisma 1 and Nexus. I changed
datamodel.prisma
to:
Copy code
type Pokemon {
      id: ID! @id @unique
      number: Int! @unique
      name: String!
      attacks: PokemonAttack
    }

    type PokemonAttack {
      id: Int! @id
      special: [Attack]
    }

    type Attack {
      id: Int! @id
      name: String
      damage: String
    }
And changed
Query.js
to:
Copy code
import { prismaObjectType } from 'nexus-prisma';

    export const Query = prismaObjectType({
      name: 'Query',
      definition(t) {
        t.crud.findManyPokemon({
          alias: 'pokemons'
        })

        t.list.field('pokemon', {
          type: 'Pokemon',
          args: {
            name: stringArg(),
          },
          resolve: (parent, { name }, ctx) => {
            return ctx.prisma.pokemon.findMany({
              where: {
                  name
              }
            })
          },
        })
      },
    });
Then I deployed the whole thing but I still don't get
name
as an argument on field
pokemon
. Idk what I am doing wrong. The complete code is in the subdirectory
prisma1-demo
→ https://github.com/deadcoder0904/graphql-and-urql-by-example/tree/master/prisma1-demo I've tried writing it from scratch and by downloading a boilerplate for the last 2 days but nothing seems to help. Any suggestions?