From c2d3ebba09be952eda84e9529938a031c8a03a16 Mon Sep 17 00:00:00 2001 From: Ly Tuan Kiet Date: Thu, 16 Jan 2025 19:38:25 +0700 Subject: [PATCH] fix: update serviceAndCategory update query structure - Modified the update query in ServiceAndCategorySchema to use a composite key for the `where` clause, ensuring that both `serviceId` and `subCategoryId` are correctly utilized for identifying records. - This change enhances the accuracy of the update operation, improving data integrity and consistency within the service and category management functionality. --- src/ServiceAndCategory/serviceandcategory.schema.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ServiceAndCategory/serviceandcategory.schema.ts b/src/ServiceAndCategory/serviceandcategory.schema.ts index 6169836..0651b2b 100644 --- a/src/ServiceAndCategory/serviceandcategory.schema.ts +++ b/src/ServiceAndCategory/serviceandcategory.schema.ts @@ -94,7 +94,12 @@ export class ServiceAndCategorySchema extends PothosSchema { resolve: async (query, _root, args, _ctx, _info) => { return await this.prisma.serviceAndCategory.update({ ...query, - where: args.where, + where: { + serviceId_subCategoryId: { + serviceId: args.where.serviceId as string, + subCategoryId: args.where.subCategoryId as string, + }, + }, data: { isDeleted: true, },