diff --git a/src/components/dashboard/RecentTasks.tsx b/src/components/dashboard/RecentTasks.tsx index f361b4c..acf58ec 100644 --- a/src/components/dashboard/RecentTasks.tsx +++ b/src/components/dashboard/RecentTasks.tsx @@ -58,6 +58,7 @@ export function RecentTasks({ tasks }: RecentTasksProps) { tfsPullRequestId={task.tfsPullRequestId} tfsProject={task.tfsProject} tfsRepository={task.tfsRepository} + todosCount={task.todosCount} availableTags={availableTags} fontSize="small" onTitleClick={() => { diff --git a/src/components/kanban/TaskCard.tsx b/src/components/kanban/TaskCard.tsx index cdfa57d..4e21fed 100644 --- a/src/components/kanban/TaskCard.tsx +++ b/src/components/kanban/TaskCard.tsx @@ -79,6 +79,7 @@ export function TaskCard({ task, onEdit, compactView = false }: TaskCardProps) { tfsPullRequestId={task.tfsPullRequestId} tfsProject={task.tfsProject} tfsRepository={task.tfsRepository} + todosCount={task.todosCount} isDragging={isDragging} isPending={isPending} onEdit={handleEdit} diff --git a/src/components/ui-showcase/UIShowcaseClient.tsx b/src/components/ui-showcase/UIShowcaseClient.tsx index ac080d4..a913303 100644 --- a/src/components/ui-showcase/UIShowcaseClient.tsx +++ b/src/components/ui-showcase/UIShowcaseClient.tsx @@ -621,6 +621,7 @@ export function UIShowcaseClient() { priority="high" tags={["Frontend", "UI"]} source="manual" + todosCount={3} fontSize="medium" availableTags={[ { id: "1", name: "Frontend", color: "#3b82f6" }, @@ -643,6 +644,7 @@ export function UIShowcaseClient() { tags={["Design", "Components"]} source="manual" dueDate={new Date(Date.now() + 7 * 24 * 60 * 60 * 1000)} + todosCount={5} fontSize="medium" availableTags={[ { id: "1", name: "Design", color: "#f59e0b" }, @@ -668,6 +670,7 @@ export function UIShowcaseClient() { jiraProject="PROJ" jiraType="Bug" dueDate={new Date(Date.now() + 3 * 24 * 60 * 60 * 1000)} + todosCount={2} fontSize="medium" availableTags={[ { id: "1", name: "Bug", color: "#ef4444" }, @@ -693,6 +696,7 @@ export function UIShowcaseClient() { tfsPullRequestId={456} tfsProject="MyProject" tfsRepository="backend-api" + todosCount={1} fontSize="medium" availableTags={[ { id: "1", name: "API", color: "#06b6d4" }, @@ -727,6 +731,7 @@ export function UIShowcaseClient() { priority="medium" tags={["Archive"]} source="manual" + todosCount={4} fontSize="small" availableTags={[ { id: "1", name: "Archive", color: "#6b7280" } @@ -739,6 +744,7 @@ export function UIShowcaseClient() { priority="high" tags={["Cancelled"]} source="manual" + todosCount={1} fontSize="small" availableTags={[ { id: "1", name: "Cancelled", color: "#ef4444" } diff --git a/src/components/ui/TaskCard.tsx b/src/components/ui/TaskCard.tsx index 01e2fb5..4eb5f8d 100644 --- a/src/components/ui/TaskCard.tsx +++ b/src/components/ui/TaskCard.tsx @@ -28,6 +28,9 @@ interface TaskCardProps extends HTMLAttributes { tfsProject?: string; tfsRepository?: string; + // Task ID for todos count + todosCount?: number; + // Interactive isDragging?: boolean; isPending?: boolean; @@ -62,6 +65,7 @@ const TaskCard = forwardRef( tfsPullRequestId, tfsProject, tfsRepository, + todosCount, isDragging = false, isPending = false, onEdit, @@ -519,6 +523,13 @@ const TaskCard = forwardRef( ✓ DONE )} + + {/* Nombre de todos reliés */} + {todosCount !== undefined && todosCount > 0 && ( + + 📝 {todosCount} + + )} diff --git a/src/lib/types.ts b/src/lib/types.ts index b1a9f8f..ad0157b 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -60,6 +60,7 @@ export interface Task { tfsTargetBranch?: string; assignee?: string; + todosCount?: number; // Nombre de todos reliés à cette tâche } // Interface pour les tags diff --git a/src/services/task-management/tasks.ts b/src/services/task-management/tasks.ts index 72dbbc2..6397ab6 100644 --- a/src/services/task-management/tasks.ts +++ b/src/services/task-management/tasks.ts @@ -37,6 +37,11 @@ export class TasksService { include: { tag: true } + }, + _count: { + select: { + dailyCheckboxes: true + } } }, take: filters?.limit, // Pas de limite par défaut - récupère toutes les tâches @@ -338,6 +343,11 @@ export class TasksService { include: { tag: true } + }, + _count: { + select: { + dailyCheckboxes: true + } } } }> | Prisma.TaskGetPayload): Task { @@ -349,6 +359,12 @@ export class TasksService { tags = prismaTask.taskTags.map((tt) => tt.tag.name); } + // Extraire le count des todos + let todosCount = 0; + if ('_count' in prismaTask && prismaTask._count) { + todosCount = prismaTask._count.dailyCheckboxes || 0; + } + return { id: prismaTask.id, title: prismaTask.title, @@ -371,7 +387,8 @@ export class TasksService { tfsRepository: prismaTask.tfsRepository ?? undefined, tfsSourceBranch: prismaTask.tfsSourceBranch ?? undefined, tfsTargetBranch: prismaTask.tfsTargetBranch ?? undefined, - assignee: prismaTask.assignee ?? undefined + assignee: prismaTask.assignee ?? undefined, + todosCount: todosCount }; } }