feat: add updatedAt field to TaskType and adjust completedAt logic

- Introduced `updatedAt` property in `TaskType` for better task tracking.
- Modified `completedAt` assignment to use `task.updatedAt` when `completedAt` is undefined, ensuring more accurate task completion timestamps.
This commit is contained in:
Julien Froidefond
2025-09-29 21:22:15 +02:00
parent 32f9d1d5de
commit 74c658b3e7

View File

@@ -8,6 +8,7 @@ type TaskType = {
priority: string; // high, medium, low priority: string; // high, medium, low
completedAt?: Date | null; completedAt?: Date | null;
createdAt: Date; createdAt: Date;
updatedAt: Date;
taskTags?: { taskTags?: {
tag: { tag: {
name: string; name: string;
@@ -159,6 +160,7 @@ export class ManagerSummaryService {
priority: true, priority: true,
completedAt: true, completedAt: true,
createdAt: true, createdAt: true,
updatedAt: true,
taskTags: { taskTags: {
select: { select: {
tag: { tag: {
@@ -258,7 +260,7 @@ export class ManagerSummaryService {
description: task.description || undefined, description: task.description || undefined,
tags: task.taskTags?.map(tt => tt.tag.name) || [], tags: task.taskTags?.map(tt => tt.tag.name) || [],
impact, impact,
completedAt: task.completedAt || getToday(), completedAt: task.completedAt || task.updatedAt,
relatedItems: [task.id], relatedItems: [task.id],
todosCount: allRelatedTodos // Nombre total de todos associés à cette tâche todosCount: allRelatedTodos // Nombre total de todos associés à cette tâche
}); });