Skip to content

Instantly share code, notes, and snippets.

@nabiltntn
Created December 28, 2018 15:24
Show Gist options
  • Select an option

  • Save nabiltntn/66abc10e4c07571bd263ff884bdb97bf to your computer and use it in GitHub Desktop.

Select an option

Save nabiltntn/66abc10e4c07571bd263ff884bdb97bf to your computer and use it in GitHub Desktop.
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