feat: count employee by gender
This commit is contained in:
parent
0bca85d460
commit
fc2d06ad5d
1 changed files with 16 additions and 0 deletions
|
|
@ -209,6 +209,22 @@ export class EmployeeController extends Controller {
|
|||
});
|
||||
}
|
||||
|
||||
@Get("stats/gender")
|
||||
async getEmployeeStatsGender(@Query() customerBranchId?: string) {
|
||||
return await prisma.employee
|
||||
.groupBy({
|
||||
_count: true,
|
||||
by: ["gender"],
|
||||
where: { customerBranchId },
|
||||
})
|
||||
.then((res) =>
|
||||
res.reduce<Record<string, number>>((a, c) => {
|
||||
a[c.gender] = c._count;
|
||||
return a;
|
||||
}, {}),
|
||||
);
|
||||
}
|
||||
|
||||
@Get()
|
||||
async list(
|
||||
@Query() zipCode?: string,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue