Last active
March 2, 2020 08:17
-
-
Save fernandodof/d7a5f87e7e44bc624332e54e48805cea 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 db = require('./database'); | |
const Query = { | |
users: () => db.users.list(), | |
user: (root, { id }) => db.users.get(id), | |
tweets: (root, { userId, last }) => { | |
const tweets = db.tweets.list().filter(tweet => tweet.userId === userId); | |
return last ? tweets.slice(-last) : tweets; | |
} | |
}; | |
module.exports = { Query }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment