diff --git a/src/controllers/03-employee-controller.ts b/src/controllers/03-employee-controller.ts index 7e0e45c..038f6bd 100644 --- a/src/controllers/03-employee-controller.ts +++ b/src/controllers/03-employee-controller.ts @@ -207,6 +207,7 @@ export class EmployeeController extends Controller { @Query() query: string = "", @Query() page: number = 1, @Query() pageSize: number = 30, + @Query() activeOnly?: boolean, ) { return this.listByCriteria( req, @@ -220,6 +221,7 @@ export class EmployeeController extends Controller { query, page, pageSize, + activeOnly, ); } @@ -237,6 +239,7 @@ export class EmployeeController extends Controller { @Query() query: string = "", @Query() page: number = 1, @Query() pageSize: number = 30, + @Query() activeOnly?: boolean, @Body() body?: { passport?: string[]; @@ -268,15 +271,17 @@ export class EmployeeController extends Controller { ] : undefined, AND: { - ...filterStatus(status), + ...filterStatus(activeOnly ? Status.ACTIVE : status), customerBranch: { + ...filterStatus(activeOnly ? Status.ACTIVE : status), id: customerBranchId, customerId, customer: isSystem(req.user) - ? undefined + ? filterStatus(activeOnly ? Status.ACTIVE : status) : { + ...filterStatus(activeOnly ? Status.ACTIVE : status), registeredBranch: { - OR: permissionCond(req.user), + OR: permissionCond(req.user, { activeOnly: activeOnly }), }, }, },