mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-22 06:28:19 +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
+47
-14
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 DlcPage from "@/pages/DlcPage";
|
||||||
import BackupManager from "@/pages/BackupManager";
|
import BackupManager from "@/pages/BackupManager";
|
||||||
import Utilities from "@/pages/Utilities";
|
import Utilities from "@/pages/Utilities";
|
||||||
import TasksListSimple from "@/pages/TasksListSimple";
|
import Tasks from "@/pages/Tasks";
|
||||||
import SavTickets from "@/pages/SavTickets";
|
import SavTickets from "@/pages/SavTickets";
|
||||||
import WeatherSettings from "@/pages/WeatherSettings";
|
import WeatherSettings from "@/pages/WeatherSettings";
|
||||||
import Layout from "@/components/Layout";
|
import Layout from "@/components/Layout";
|
||||||
@@ -94,7 +94,7 @@ function RouterProduction() {
|
|||||||
<Route path="/customer-orders" component={CustomerOrders} />
|
<Route path="/customer-orders" component={CustomerOrders} />
|
||||||
<Route path="/dlc" component={DlcPage} />
|
<Route path="/dlc" component={DlcPage} />
|
||||||
<Route path="/utilities" component={Utilities} />
|
<Route path="/utilities" component={Utilities} />
|
||||||
<Route path="/tasks" component={TasksListSimple} />
|
<Route path="/tasks" component={Tasks} />
|
||||||
<Route path="/sav" component={SavTickets} />
|
<Route path="/sav" component={SavTickets} />
|
||||||
|
|
||||||
{/* Routes de compatibilité - redirection vers utilities */}
|
{/* Routes de compatibilité - redirection vers utilities */}
|
||||||
|
|||||||
+45
-12
@@ -1711,20 +1711,53 @@ export class DatabaseStorage implements IStorage {
|
|||||||
dueDateISO: taskData.dueDate instanceof Date ? taskData.dueDate.toISOString() : taskData.dueDate
|
dueDateISO: taskData.dueDate instanceof Date ? taskData.dueDate.toISOString() : taskData.dueDate
|
||||||
});
|
});
|
||||||
|
|
||||||
const [task] = await db
|
// Validation des données avant update
|
||||||
.update(tasks)
|
if (!taskData || typeof taskData !== 'object') {
|
||||||
.set({ ...taskData, updatedAt: new Date() })
|
throw new Error('Invalid task data provided');
|
||||||
.where(eq(tasks.id, id))
|
}
|
||||||
.returning();
|
|
||||||
|
|
||||||
console.log('💾 DatabaseStorage.updateTask - Result:', {
|
// Nettoyer les données pour éviter les problèmes de type
|
||||||
taskId: task.id,
|
const cleanData: any = {};
|
||||||
title: task.title,
|
|
||||||
dueDate: task.dueDate,
|
|
||||||
dueDateType: typeof task.dueDate
|
|
||||||
});
|
|
||||||
|
|
||||||
return task;
|
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
|
||||||
|
});
|
||||||
|
|
||||||
|
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> {
|
async deleteTask(id: number): Promise<void> {
|
||||||
|
|||||||
Reference in new issue
Block a user