Created
November 30, 2016 22:01
-
-
Save holmesal/7737c9882c285d7ea842fbff3e3d73f5 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
var UserType = new GraphQLObjectType({ | |
name: 'User', | |
description: 'A venerable Chorus user', | |
isTypeOf: (obj, info) => obj instanceof db.User, | |
interfaces: [nodeDefinitions.nodeInterface], | |
fields: () => ({ | |
id: globalIdField('User'), | |
username: { | |
type: GraphQLString, | |
description: 'A username.', | |
resolve: user => user.get('username') | |
}, | |
viewerIsFollowing: { | |
type: GraphQLBoolean, | |
description: 'Whether you are following this user', | |
resolve: async (user, args, { user: viewer }) => { | |
const isFollowing = await viewer.isFollowing(user); | |
return isFollowing ? true : false; | |
} | |
} | |
email: { | |
type: GraphQLString, | |
description: 'An email address on the World Wide Web.', | |
resolve: user => user.get('email') | |
} | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment