fix: employee stats not working as expected
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 4s
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 4s
This commit is contained in:
parent
acd6bb35e9
commit
15381c089c
1 changed files with 11 additions and 2 deletions
|
|
@ -144,9 +144,18 @@ type EmployeeUpdate = {
|
|||
export class EmployeeController extends Controller {
|
||||
@Get("stats")
|
||||
@Security("keycloak")
|
||||
async getEmployeeStats(@Query() customerBranchId?: string) {
|
||||
async getEmployeeStats(@Request() req: RequestWithUser, @Query() customerBranchId?: string) {
|
||||
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