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

This commit is contained in:
Methapon2001 2025-07-03 10:34:51 +07:00
parent a2ad2443c3
commit 953faec570

View file

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