fix order mutation

This commit is contained in:
2024-10-15 16:20:25 +07:00
parent 5760e0a56d
commit f5654e267b

View File

@@ -65,6 +65,9 @@ export class OrderSchema extends PothosSchema {
});
},
}),
}));
// mutation section
this.builder.mutationFields((t) => ({
createOrder: t.prismaField({
type: this.order(),
args: {
@@ -80,6 +83,21 @@ export class OrderSchema extends PothosSchema {
});
},
}),
deleteOrder: t.prismaField({
type: this.order(),
args: {
where: t.arg({
type: this.builder.generator.getWhereUnique('Order'),
required: true,
}),
},
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.order.delete({
...query,
where: args.where,
});
},
}),
updateOrder: t.prismaField({
type: this.order(),
args: {