diff --git a/src/controllers/product-service-controller.ts b/src/controllers/product-service-controller.ts index 0e278e0..c60ccba 100644 --- a/src/controllers/product-service-controller.ts +++ b/src/controllers/product-service-controller.ts @@ -64,11 +64,11 @@ 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})`); + and.push(Prisma.sql`"productTypeId" = ${productTypeId}`); } if (registeredBranchId) { and.push( - Prisma.sql`("registeredBranchId" = ${registeredBranchId} OR "registeredBranchId" = null)`, + Prisma.sql`("registeredBranchId" = ${registeredBranchId} OR "registeredBranchId" IS NULL)`, ); } @@ -78,6 +78,7 @@ export class ProductServiceController extends Controller { ${or.length > 0 && and.length > 0 ? Prisma.sql` AND ` : Prisma.empty} ${and.length > 0 ? Prisma.join(and, " AND ", "(", ")") : Prisma.empty} `; + console.log(where.sql); const [result, [{ total }]] = await prisma.$transaction([ prisma.$queryRaw<((Product & { type: "product" }) | (Service & { type: "service" }))[]>`