Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created October 8, 2020 10:48
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 velotiotech/0b0c2fe9bbe7cba3c65b46204feccefc to your computer and use it in GitHub Desktop.
Save velotiotech/0b0c2fe9bbe7cba3c65b46204feccefc to your computer and use it in GitHub Desktop.
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