Skip to content

Instantly share code, notes, and snippets.

@matthieu-D
Created August 31, 2017 13:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthieu-D/bdde65afc3e4dd4561a43cb95c43d549 to your computer and use it in GitHub Desktop.
Save matthieu-D/bdde65afc3e4dd4561a43cb95c43d549 to your computer and use it in GitHub Desktop.
var MutationUpdate = {
type: new GraphQLList(UserType),
description: 'Update a User',
args: {
id: {
name: 'User id',
type: new GraphQLNonNull(GraphQLFloat)
},
newName: {
name: 'New user name',
type: new GraphQLNonNull(GraphQLString)
}
},
resolve: (root, {id, newName}) => {
var selectedUser = USERs.filter(function(user) {
return user.id === id;
})[0];
selectedUser.name = newName;
return USERs;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment