Created
December 28, 2018 15:24
-
-
Save nabiltntn/66abc10e4c07571bd263ff884bdb97bf 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
| import { isSuperAdminResolver, isAdminResolver } from '../baseResolvers'; | |
| export default { | |
| Mutation: { | |
| // createProject is a mutation resolver that requires user with SUPER_ADMIn role | |
| createProject: isSuperAdminResolver( | |
| (root, { input }, context) => | |
| context.Projects.createProject(input, context.user.userId), | |
| { | |
| category: 'PROJECT', | |
| type: 'CREATE' | |
| } | |
| ), | |
| // editProject is a mutation resolver that requires user with ADMIN role at least | |
| editProject: isAdminResolver( | |
| (root, { input }, context) => | |
| context.Projects.editProject({ input }), | |
| { | |
| category: 'PROJECT', | |
| type: 'EDIT' | |
| } | |
| ), | |
| }, | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment