more mutation on center

This commit is contained in:
2024-10-11 17:58:13 +07:00
parent 2893b43d30
commit c3678cf6c5

View File

@@ -83,6 +83,41 @@ export class CenterSchema extends PothosSchema {
});
},
}),
updateCenter: t.prismaField({
type: this.center(),
args: {
input: t.arg({
type: this.builder.generator.getUpdateInput('Center'),
required: true,
}),
where: t.arg({
type: this.builder.generator.getWhereUnique('Center'),
required: true,
}),
},
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.center.update({
...query,
where: args.where,
data: args.input,
});
},
}),
deleteCenter: t.prismaField({
type: this.center(),
args: {
where: t.arg({
type: this.builder.generator.getWhereUnique('Center'),
required: true,
}),
},
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.center.delete({
...query,
where: args.where,
});
},
}),
}));
}
}