fix: employee stats not working as expected
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 6s
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 6s
This commit is contained in:
parent
a2ad2443c3
commit
953faec570
1 changed files with 11 additions and 2 deletions
|
|
@ -146,9 +146,18 @@ type EmployeeUpdate = {
|
||||||
export class EmployeeController extends Controller {
|
export class EmployeeController extends Controller {
|
||||||
@Get("stats")
|
@Get("stats")
|
||||||
@Security("keycloak")
|
@Security("keycloak")
|
||||||
async getEmployeeStats(@Query() customerBranchId?: string) {
|
async getEmployeeStats(@Request() req: RequestWithUser, @Query() customerBranchId?: string) {
|
||||||
return await prisma.employee.count({
|
return await prisma.employee.count({
|
||||||
where: { customerBranchId },
|
where: {
|
||||||
|
customerBranchId,
|
||||||
|
customerBranch: {
|
||||||
|
customer: isSystem(req.user)
|
||||||
|
? undefined
|
||||||
|
: {
|
||||||
|
registeredBranch: { OR: permissionCond(req.user) },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue