Skip to content

Instantly share code, notes, and snippets.

@daniele-zurico
Created June 5, 2018 11:25
Show Gist options
  • Save daniele-zurico/2a15f1c28b9cb616ac4bb72bac41a8c9 to your computer and use it in GitHub Desktop.
Save daniele-zurico/2a15f1c28b9cb616ac4bb72bac41a8c9 to your computer and use it in GitHub Desktop.
import { userController } from "../controllers/controllers";
import { AuthenticationError } from "apollo-server";
const userResolver = {
Mutation: {
addUser(root: any, args: any) {
return userController.addUser(root, args);
},
deleteUser(root: any, args: any) {
return userController.deleteUser(root, args);
},
updateUser(root: any, args: any) {
return userController.updateUser(root, args);
}
},
Query: {
allUsers(root: any, args: any, context: any) {
//use context if you want to restrict the usage
return userController.users(root, args);
}
}
};
export default userResolver;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment