diff --git a/attached_assets/{91C8B3DA-D7C8-4ADA-83AA-0709433632EF}_1755601835606.png b/attached_assets/{91C8B3DA-D7C8-4ADA-83AA-0709433632EF}_1755601835606.png new file mode 100644 index 0000000..9417e23 Binary files /dev/null and b/attached_assets/{91C8B3DA-D7C8-4ADA-83AA-0709433632EF}_1755601835606.png differ diff --git a/client/src/components/RouterProduction.tsx b/client/src/components/RouterProduction.tsx index 44ed4c5..16c6445 100644 --- a/client/src/components/RouterProduction.tsx +++ b/client/src/components/RouterProduction.tsx @@ -19,7 +19,7 @@ import CustomerOrders from "@/pages/CustomerOrders"; import DlcPage from "@/pages/DlcPage"; import BackupManager from "@/pages/BackupManager"; import Utilities from "@/pages/Utilities"; -import TasksListSimple from "@/pages/TasksListSimple"; +import Tasks from "@/pages/Tasks"; import SavTickets from "@/pages/SavTickets"; import WeatherSettings from "@/pages/WeatherSettings"; import Layout from "@/components/Layout"; @@ -94,7 +94,7 @@ function RouterProduction() { - + {/* Routes de compatibilité - redirection vers utilities */} diff --git a/server/storage.ts b/server/storage.ts index 780f9a7..7d59452 100644 --- a/server/storage.ts +++ b/server/storage.ts @@ -1710,21 +1710,54 @@ export class DatabaseStorage implements IStorage { dueDateType: typeof taskData.dueDate, dueDateISO: taskData.dueDate instanceof Date ? taskData.dueDate.toISOString() : taskData.dueDate }); + + // Validation des données avant update + if (!taskData || typeof taskData !== 'object') { + throw new Error('Invalid task data provided'); + } + + // Nettoyer les données pour éviter les problèmes de type + const cleanData: any = {}; - const [task] = await db - .update(tasks) - .set({ ...taskData, updatedAt: new Date() }) - .where(eq(tasks.id, id)) - .returning(); + if (taskData.title !== undefined) cleanData.title = taskData.title; + if (taskData.description !== undefined) cleanData.description = taskData.description; + if (taskData.priority !== undefined) cleanData.priority = taskData.priority; + if (taskData.status !== undefined) cleanData.status = taskData.status; + if (taskData.assignedTo !== undefined) cleanData.assignedTo = taskData.assignedTo; + if (taskData.startDate !== undefined) { + cleanData.startDate = taskData.startDate === '' ? null : taskData.startDate; + } + if (taskData.dueDate !== undefined) { + cleanData.dueDate = taskData.dueDate === '' ? null : taskData.dueDate; + } + + cleanData.updatedAt = new Date(); + + console.log('🧹 Cleaned data for database update:', cleanData); + + try { + const [task] = await db + .update(tasks) + .set(cleanData) + .where(eq(tasks.id, id)) + .returning(); + + console.log('✅ DatabaseStorage.updateTask - Success:', { + taskId: task.id, + title: task.title, + dueDate: task.dueDate, + dueDateType: typeof task.dueDate + }); - console.log('💾 DatabaseStorage.updateTask - Result:', { - taskId: task.id, - title: task.title, - dueDate: task.dueDate, - dueDateType: typeof task.dueDate - }); - - return task; + return task; + } catch (error) { + console.error('❌ DatabaseStorage.updateTask - Database Error:', { + taskId: id, + error: error instanceof Error ? error.message : String(error), + cleanData + }); + throw new Error(`Failed to update task in database: ${error instanceof Error ? error.message : String(error)}`); + } } async deleteTask(id: number): Promise {