Created
April 2, 2020 09:31
-
-
Save lorensr/e184c1bc8fd859086832e14d5a09ce0b to your computer and use it in GitHub Desktop.
This file contains 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: { | |
getFoo: (_, { id }, context) => | |
context.dataSources.myFoos.get(id, { ttlInSeconds: 60 }) | |
}, | |
Mutation: { | |
updateFoo: async (_, { id, fields }, context) => { | |
if (context.isAdmin) { | |
context.dataSources.myFoos.updateFields(id, fields) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment