From db3bdfb25d9a783abc8ad9fe05129ab4ca5c76a6 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Wed, 18 Dec 2024 16:29:48 +0700 Subject: [PATCH] fix: active regis branch only not work --- src/controllers/03-customer-branch-controller.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/controllers/03-customer-branch-controller.ts b/src/controllers/03-customer-branch-controller.ts index 62f0e30..8892365 100644 --- a/src/controllers/03-customer-branch-controller.ts +++ b/src/controllers/03-customer-branch-controller.ts @@ -214,8 +214,10 @@ export class CustomerBranchController extends Controller { ? { registeredBranchId, registeredBranch: branchActiveOnlyCond(activeRegisBranchOnly), + ...filterStatus(activeRegisBranchOnly ? Status.ACTIVE : status), } : { + ...filterStatus(activeRegisBranchOnly ? Status.ACTIVE : status), registeredBranch: { AND: { id: registeredBranchId }, OR: company @@ -225,7 +227,7 @@ export class CustomerBranchController extends Controller { }, customerId, subDistrict: zipCode ? { zipCode } : undefined, - ...filterStatus(status), + ...filterStatus(activeRegisBranchOnly ? Status.ACTIVE : status), }, } satisfies Prisma.CustomerBranchWhereInput;