Created
October 8, 2020 10:48
-
-
Save velotiotech/0b0c2fe9bbe7cba3c65b46204feccefc to your computer and use it in GitHub Desktop.
This file contains 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 { ObjectId } from 'bson'; | |
import { IResolvers } from 'graphql-tools'; | |
import { IUserProps } from './user.model'; | |
import { UserService } from './user.service'; | |
const userService = new UserService(); | |
export const userResolvers: IResolvers = { | |
Query: { | |
User: (_root: unknown, args: { id: ObjectId }) => userService.get(args.id), | |
//... | |
}, | |
Mutation: { | |
createUser: async (_root: unknown, args: IUserProps) => await userService.create(args), | |
//... | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment