feat: add todosCount to RecentTasks and TaskCard components

- Included `todosCount` prop in `RecentTasks` and `TaskCard` for better task management visibility.
- Updated `TaskCard` UI to display the number of related todos, enhancing user interaction.
- Modified `Task` interface and `TasksService` to support todos count retrieval from the database.
- Added sample `todosCount` values in `UIShowcaseClient` for demonstration purposes.
This commit is contained in:
Julien Froidefond
2025-09-29 21:30:24 +02:00
parent 74c658b3e7
commit ec6c51f9ec
6 changed files with 38 additions and 1 deletions

View File

@@ -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<object>): 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
};
}
}