Created
August 24, 2017 16:50
-
-
Save rafaelvicio/fe70c25d432df3d3eeaf5b6ac46475f8 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
resolvers: { | |
RootQuery: { | |
posts: () => posts, | |
post: async (_, { id }) => | |
await Post.query() | |
}, | |
RootMutations: { | |
createPost: async (_, { input }) => | |
await Post.query.insert(input) | |
}, | |
RootSubscriptions: { | |
postAdded: { | |
subscribe: () => | |
pubsub.asyncIterator('postAdded') | |
}, | |
Post: { | |
author: async post => | |
await Usuario.query().where("id", "=", post.author_id) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment