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:
@@ -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
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user