Created
December 16, 2018 15:52
-
-
Save redbluenat/8392934a5122145c00754c912a14f32f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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