mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-20 21:49:07 +02:00
Improve task update logging and handle date formatting errors
Refine error logging in task update routes and storage, and adjust date handling to correctly process null or empty date strings, preventing runtime 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/mibRh7v
This commit is contained in:
1 parent
c3f08bb788
commit
24b7d67745
4 files changed
+218
-6
No files matched your search
+13
-3
@@ -1482,11 +1482,21 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
||||
});
|
||||
res.json(updatedTask);
|
||||
} catch (error) {
|
||||
console.error("❌ Error updating task:", {
|
||||
taskId: id,
|
||||
const taskId = parseInt(req.params.id);
|
||||
console.error("❌ Error updating task in route:", {
|
||||
taskId: taskId,
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
stack: error instanceof Error ? error.stack : undefined,
|
||||
reqBody: req.body
|
||||
reqBody: req.body,
|
||||
cleanData: req.body ? {
|
||||
title: req.body.title,
|
||||
description: req.body.description,
|
||||
priority: req.body.priority,
|
||||
status: req.body.status,
|
||||
assignedTo: req.body.assignedTo,
|
||||
startDate: req.body.startDate,
|
||||
dueDate: req.body.dueDate,
|
||||
} : null
|
||||
});
|
||||
res.status(500).json({
|
||||
message: "Failed to update task",
|
||||
|
||||
+5
-3
@@ -1725,10 +1725,10 @@ export class DatabaseStorage implements IStorage {
|
||||
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;
|
||||
cleanData.startDate = taskData.startDate === '' || taskData.startDate === null ? null : taskData.startDate;
|
||||
}
|
||||
if (taskData.dueDate !== undefined) {
|
||||
cleanData.dueDate = taskData.dueDate === '' ? null : taskData.dueDate;
|
||||
cleanData.dueDate = taskData.dueDate === '' || taskData.dueDate === null ? null : taskData.dueDate;
|
||||
}
|
||||
|
||||
cleanData.updatedAt = new Date();
|
||||
@@ -1754,7 +1754,9 @@ export class DatabaseStorage implements IStorage {
|
||||
console.error('❌ DatabaseStorage.updateTask - Database Error:', {
|
||||
taskId: id,
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
cleanData
|
||||
stack: error instanceof Error ? error.stack : undefined,
|
||||
cleanData,
|
||||
originalTaskData: taskData
|
||||
});
|
||||
throw new Error(`Failed to update task in database: ${error instanceof Error ? error.message : String(error)}`);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user