Skip to content

Instantly share code, notes, and snippets.

@redbluenat
Created December 16, 2018 15:52
Show Gist options
  • Save redbluenat/8392934a5122145c00754c912a14f32f to your computer and use it in GitHub Desktop.
Save redbluenat/8392934a5122145c00754c912a14f32f to your computer and use it in GitHub Desktop.
const resolvers = {
Query: {
dogName: () => `Tommy the chihuahua`,
dogs: (root, args, context, queryInfo) => {
return context.db.query.dogs({}, queryInfo);
}
},
Mutation: {
dog: (root, args, context, queryInfo) => {
return context.db.mutation.createDog(
{
data: {
type: args.type,
name: args.name
}
},
queryInfo
);
},
updateDog: (root, args, context, queryInfo) => {
return context.db.mutation.updateDog(
{
data: {
type: args.type,
name: args.name
},
where: {
id: args.id
}
},
queryInfo
);
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment