From e3e44d03b59d83258d57dd26be545f79e447b9e2 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Tue, 25 Jun 2024 13:00:15 +0700 Subject: [PATCH] fix: service not included in result --- src/controllers/product-service-controller.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/controllers/product-service-controller.ts b/src/controllers/product-service-controller.ts index 7a976f2..c7954b7 100644 --- a/src/controllers/product-service-controller.ts +++ b/src/controllers/product-service-controller.ts @@ -59,7 +59,9 @@ export class ProductServiceController extends Controller { if (query) or.push(Prisma.sql`"name" LIKE '%${query}%'`); if (status) and.push(Prisma.sql`"status" = ${status}::"Status"`); - if (productTypeId) and.push(Prisma.sql`"productTypeId" = ${productTypeId}`); + if (productTypeId) { + and.push(Prisma.sql`("productTypeId" = ${productTypeId} OR ("type" = 'service'))`); + } const where = Prisma.sql` ${or.length > 0 || and.length > 0 ? Prisma.sql`WHERE ` : Prisma.empty}