Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Last active October 9, 2020 05:11
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
import { Arg, Ctx, Mutation, Resolver } from 'type-graphql';
import { User } from './user.model';
import { UserService } from './user.service';
@Resolver(_of => User)
export class UserResolver {
private __userService: UserService;
constructor() {
this.__userService = new UserService();
}
@Mutation(_returns => User)
async createUser(@Arg('data', type => UserCreateInput) data: UserCreateInput, @Ctx() ctx: any) {
return this.__userService.create(data)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment