diff --git a/src/user/user.schema.ts b/src/user/user.schema.ts index 2310066..22c0cae 100644 --- a/src/user/user.schema.ts +++ b/src/user/user.schema.ts @@ -69,11 +69,29 @@ export class UserSchema extends PothosSchema { }, }), })); - } - // Mutation section - @Pothos() - createUser() { - return 'createUser'; + // Mutation section + this.builder.mutationFields((t) => ({ + updateUser: t.prismaField({ + type: this.user(), + args: { + input: t.arg({ + type: this.builder.generator.getUpdateInput('User'), + required: true, + }), + where: t.arg({ + type: this.builder.generator.getWhereUnique('User'), + required: true, + }), + }, + resolve: async (query, root, args, ctx, info) => { + return await this.prisma.user.update({ + ...query, + where: args.where, + data: args.input, + }); + }, + }), + })); } }