fix(hermes-tasks): department counts stability and mobile responsive cards
Deploy Canina / deploy (push) Successful in 2m33s
Deploy Canina / deploy (push) Successful in 2m33s
This commit is contained in:
1 parent
8c4faf8820
commit
a6d0269427
3 files changed
+112
-48
No files matched your search
@@ -120,7 +120,22 @@ export class CorporateService {
|
||||
take: p.limit,
|
||||
orderBy: [{ [p.sortBy]: p.sortOrder }, { id: 'asc' }],
|
||||
});
|
||||
return publicData({ data, meta: meta(total, p.page, p.limit) });
|
||||
const deptGroup = await tx.corporateTask.groupBy({
|
||||
by: ['department'],
|
||||
_count: { id: true },
|
||||
});
|
||||
const departmentCounts: Record<string, number> = {};
|
||||
for (const d of departments) departmentCounts[d] = 0;
|
||||
for (const row of deptGroup) {
|
||||
departmentCounts[row.department] = row._count.id;
|
||||
}
|
||||
return publicData({
|
||||
data,
|
||||
meta: {
|
||||
...meta(total, p.page, p.limit),
|
||||
departmentCounts,
|
||||
},
|
||||
});
|
||||
},
|
||||
{ isolationLevel: Prisma.TransactionIsolationLevel.RepeatableRead },
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user