add mutation update user info
This commit is contained in:
@@ -69,11 +69,29 @@ export class UserSchema extends PothosSchema {
|
|||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
}));
|
}));
|
||||||
}
|
|
||||||
|
|
||||||
// Mutation section
|
// Mutation section
|
||||||
@Pothos()
|
this.builder.mutationFields((t) => ({
|
||||||
createUser() {
|
updateUser: t.prismaField({
|
||||||
return 'createUser';
|
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,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user