feat: add support for active only employee

resolves https://github.com/Frappet/jws-frontend/issues/147
This commit is contained in:
Methapon2001 2024-12-18 17:25:30 +07:00
parent db3bdfb25d
commit 083c8fcc02

View file

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