This commit is contained in:
UltraLionFr
2025-12-07 00:44:44 +01:00
parent 765e9a6c1a
commit fca0f438d8
2 changed files with 15 additions and 4 deletions
+11 -3
View File
@@ -110,9 +110,16 @@ export default async function CategoriesPage() {
// Compter les tutoriels par catégorie
const counts = await prisma.tutorial.groupBy({
by: ["categoryId"],
_count: true,
_count: {
_all: true,
},
});
const countMap = new Map(counts.map((c) => [c.categoryId, c._count]));
const countMap = new Map(
counts.map((c: (typeof counts)[number]) => [
c.categoryId,
c._count._all,
])
);
return (
<div className="space-y-8">
@@ -208,7 +215,8 @@ export default async function CategoriesPage() {
<div className="bg-slate-900/80 border border-slate-700/50 rounded-lg overflow-hidden">
<div className="divide-y divide-slate-800/50">
{categories.map((cat) => {
const tutorialCount = countMap.get(cat.id) || 0;
const tutorialCount =
(countMap.get(cat.id) as number) || 0;
return (
<div