diff --git a/src/controllers/product-service-controller.ts b/src/controllers/product-service-controller.ts index f81f813..0e278e0 100644 --- a/src/controllers/product-service-controller.ts +++ b/src/controllers/product-service-controller.ts @@ -12,6 +12,7 @@ export class ProductServiceController extends Controller { @Query() productTypeId?: string, @Query() page: number = 1, @Query() pageSize: number = 30, + @Query() registeredBranchId?: string, ) { const union = Prisma.sql` SELECT @@ -27,6 +28,7 @@ export class ProductServiceController extends Controller { "status", "statusOrder", "productTypeId", + "registeredBranchId", "createdByUserId", "createdAt", "updatedByUserId", @@ -47,6 +49,7 @@ export class ProductServiceController extends Controller { "status", "statusOrder", "productTypeId", + "registeredBranchId", "createdByUserId", "createdAt", "updatedByUserId", @@ -63,6 +66,11 @@ export class ProductServiceController extends Controller { if (productTypeId) { and.push(Prisma.sql`("productTypeId" = ${productTypeId})`); } + if (registeredBranchId) { + and.push( + Prisma.sql`("registeredBranchId" = ${registeredBranchId} OR "registeredBranchId" = null)`, + ); + } const where = Prisma.sql` ${or.length > 0 || and.length > 0 ? Prisma.sql`WHERE ` : Prisma.empty}