Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Last active October 9, 2020 05:11
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/235e4a1a65a1728b5c441e73655e1841 to your computer and use it in GitHub Desktop.
Save velotiotech/235e4a1a65a1728b5c441e73655e1841 to your computer and use it in GitHub Desktop.
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