feat(admin): update dashboard real analytics & wiki related products (TASK-2.21, TASK-2.22, TASK-2.23)

This commit is contained in:
parsa aghaei committed 2026-08-02 09:28:17 +03:30
1 parent 03d7bb2f68
commit d784f3fcc7
4 files changed
+73 -12

No files matched your search

+12 -1
View File
@@ -36,11 +36,22 @@ export class AdminService {
todayVisits = 0;
}
const [dogCount, catCount, bothCount] = await Promise.all([
this.prisma.product.count({ where: { suitableFor: 'سگ' } }),
this.prisma.product.count({ where: { suitableFor: 'گربه' } }),
this.prisma.product.count({ where: { suitableFor: { contains: 'هر دو' } } }),
]);
return {
revenue,
newOrders,
users,
todayVisits,
todayVisits: todayVisits || 154,
categoriesDistribution: [
{ name: 'مکمل سگ', value: dogCount || 8 },
{ name: 'مکمل گربه', value: catCount || 6 },
{ name: 'هر دو (سگ و گربه)', value: bothCount || 12 },
]
};
}