fix: employee stats not working as expected
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 4s

This commit is contained in:
Methapon2001 2025-07-03 10:34:51 +07:00
parent acd6bb35e9
commit 15381c089c

View file

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