I'm trying to setup the updateNode mutation in graphql with Prisma running on GraphQL-yoga server. Here's the error I'm receiving when I try to run the mutation:
"Variable \"$_v0_data\" got invalid value { data: { name: \"Test\" }, where: { id: \"cjqulnr0yftuh0a71sdkek697\" } }; Field \"data\" is not defined by type CocktailUpdateInput.\nVariable \"$_v0_data\" got invalid value { data: { name: \"Test\" }, where: { id: \"cjqulnr0yftuh0a71sdkek697\" } }; Field \"where\" is not defined by type CocktailUpdateInput."
Here's my mutation resolver:
const Mutation = {
async updateCocktail(parent, args, ctx, info) {
const data = { ...args };
delete data.id;
const where = {id: args.id};
return await ctx.db.mutation.updateCocktail({ data, where }, info);
},
}
datamodel.prisma:
type Cocktail {
id: ID! @unique
name: String!
info: String
glass: Glass
ingredients: [Ingredient]
steps: [Step]
}
schema.graphql
type Mutation {
updateCocktail(data: CocktailUpdateInput!, where: CocktailWhereUniqueInput!): Cocktail
}
and finally here's what I'm trying to execute in playground:
mutation{
updateCocktail(
where: {id: "cjqulnr0y0tuh0a71sdkek697"},
data: {
name: "Test"
}
){
id
name
}
}