Akshay Kadam (A2K)
08/23/2019, 9:43 AMdatamodel.prisma to:
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:
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?