From a62d729ce6b9b57aaae413b43c1d072f8899c58f Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Wed, 18 Dec 2024 17:48:50 +0700 Subject: [PATCH] refactor: change condition for active only filter --- src/controllers/03-employee-controller.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/controllers/03-employee-controller.ts b/src/controllers/03-employee-controller.ts index 038f6bd..994e246 100644 --- a/src/controllers/03-employee-controller.ts +++ b/src/controllers/03-employee-controller.ts @@ -273,13 +273,13 @@ export class EmployeeController extends Controller { AND: { ...filterStatus(activeOnly ? Status.ACTIVE : status), customerBranch: { - ...filterStatus(activeOnly ? Status.ACTIVE : status), + status: activeOnly ? { not: Status.INACTIVE } : undefined, id: customerBranchId, customerId, customer: isSystem(req.user) - ? filterStatus(activeOnly ? Status.ACTIVE : status) + ? { status: activeOnly ? { not: Status.INACTIVE } : undefined } : { - ...filterStatus(activeOnly ? Status.ACTIVE : status), + status: activeOnly ? { not: Status.INACTIVE } : undefined, registeredBranch: { OR: permissionCond(req.user, { activeOnly: activeOnly }), },