Last active
April 22, 2019 11:36
-
-
Save motephyr/c0b540136dfff18178d70c02270a30af 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
// app/data/resolvers.js | |
const resolvers = { | |
Query: { | |
... | |
async users() { | |
const users = await User.all() | |
return users.toJSON() | |
}, | |
... | |
}, | |
User: { | |
async group(user, _, { loaders: { user_group } }) { | |
return user_group.load(user.group_id) | |
}, | |
async personal_data(user, _, { loaders: { user_personal_data } }) { | |
return user_personal_data.load(user.id) | |
}, | |
async posts(user, _, { loaders: { user_posts } }) { | |
return user_posts.load(user.id) | |
} | |
}, | |
... | |
} | |
module.exports = resolvers |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment