refactor: change condition for active only filter

This commit is contained in:
Methapon2001 2024-12-18 17:48:50 +07:00
parent 9426a6b3ba
commit a62d729ce6

View file

@ -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 }),
},