mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-21 14:08:15 +02:00
5 files changed
+71
-25
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 55 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 54 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 */}
|
||||||
|
|||||||
+24
-11
@@ -1456,15 +1456,20 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Nettoyer les données reçues pour éviter les problèmes de types
|
// Nettoyer les données reçues pour éviter les problèmes de types
|
||||||
const cleanData = {
|
const cleanData: any = {};
|
||||||
...(req.body.title && { title: req.body.title }),
|
|
||||||
...(req.body.description !== undefined && { description: req.body.description }),
|
// Ne pas utiliser de conditions qui ignorent les valeurs falsy légitimes
|
||||||
...(req.body.priority && { priority: req.body.priority }),
|
if (req.body.title !== undefined) cleanData.title = req.body.title;
|
||||||
...(req.body.status && { status: req.body.status }),
|
if (req.body.description !== undefined) cleanData.description = req.body.description;
|
||||||
...(req.body.assignedTo && { assignedTo: req.body.assignedTo }),
|
if (req.body.priority !== undefined) cleanData.priority = req.body.priority;
|
||||||
...(req.body.startDate !== undefined && { startDate: req.body.startDate === '' ? null : req.body.startDate }),
|
if (req.body.status !== undefined) cleanData.status = req.body.status;
|
||||||
...(req.body.dueDate !== undefined && { dueDate: req.body.dueDate === '' ? null : req.body.dueDate }),
|
if (req.body.assignedTo !== undefined) cleanData.assignedTo = req.body.assignedTo;
|
||||||
};
|
if (req.body.startDate !== undefined) {
|
||||||
|
cleanData.startDate = req.body.startDate === '' ? null : req.body.startDate;
|
||||||
|
}
|
||||||
|
if (req.body.dueDate !== undefined) {
|
||||||
|
cleanData.dueDate = req.body.dueDate === '' ? null : req.body.dueDate;
|
||||||
|
}
|
||||||
|
|
||||||
console.log('🧹 Cleaned data for update:', cleanData);
|
console.log('🧹 Cleaned data for update:', cleanData);
|
||||||
|
|
||||||
@@ -1477,8 +1482,16 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
|||||||
});
|
});
|
||||||
res.json(updatedTask);
|
res.json(updatedTask);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error updating task:", error);
|
console.error("❌ Error updating task:", {
|
||||||
res.status(500).json({ message: "Failed to update task" });
|
taskId: id,
|
||||||
|
error: error instanceof Error ? error.message : String(error),
|
||||||
|
stack: error instanceof Error ? error.stack : undefined,
|
||||||
|
reqBody: req.body
|
||||||
|
});
|
||||||
|
res.status(500).json({
|
||||||
|
message: "Failed to update task",
|
||||||
|
details: error instanceof Error ? error.message : String(error)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+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