mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
Update task module presentation and resolve console errors
Refactor task route to use a new component and implement data validation and cleaning before updating tasks in the database to prevent errors. Replit-Commit-Author: Agent Replit-Commit-Session-Id: cc2d271b-82f0-4d6a-9302-a0b067ffb429 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/cc2d271b-82f0-4d6a-9302-a0b067ffb429/grlWN1D
This commit is contained in:
1 parent
26579affb3
commit
a2eecfb2ac
3 files changed
+48
-15
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 55 KiB |
@@ -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() {
|
||||
<Route path="/customer-orders" component={CustomerOrders} />
|
||||
<Route path="/dlc" component={DlcPage} />
|
||||
<Route path="/utilities" component={Utilities} />
|
||||
<Route path="/tasks" component={TasksListSimple} />
|
||||
<Route path="/tasks" component={Tasks} />
|
||||
<Route path="/sav" component={SavTickets} />
|
||||
|
||||
{/* Routes de compatibilité - redirection vers utilities */}
|
||||
|
||||
+46
-13
@@ -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<void> {
|
||||
|
||||
Reference in new issue
Block a user