mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-15 03:09:32 +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
+200
@@ -0,0 +1,200 @@
|
||||
|
||||
|
||||
startDate: '2025-08-20',
|
||||
|
||||
dueDate: '2025-08-21'
|
||||
|
||||
}
|
||||
|
||||
💾 DatabaseStorage.updateTask - Input: {
|
||||
|
||||
taskId: 99,
|
||||
|
||||
taskData: {
|
||||
|
||||
title: 'test',
|
||||
|
||||
description: 'test',
|
||||
|
||||
priority: 'medium',
|
||||
|
||||
status: 'pending',
|
||||
|
||||
assignedTo: 'test',
|
||||
|
||||
startDate: '2025-08-20',
|
||||
|
||||
dueDate: '2025-08-21'
|
||||
|
||||
},
|
||||
|
||||
dueDate: '2025-08-21',
|
||||
|
||||
dueDateType: 'string',
|
||||
|
||||
dueDateISO: '2025-08-21'
|
||||
|
||||
}
|
||||
|
||||
🧹 Cleaned data for database update: {
|
||||
|
||||
title: 'test',
|
||||
|
||||
description: 'test',
|
||||
|
||||
priority: 'medium',
|
||||
|
||||
status: 'pending',
|
||||
|
||||
assignedTo: 'test',
|
||||
|
||||
startDate: '2025-08-20',
|
||||
|
||||
dueDate: '2025-08-21',
|
||||
|
||||
updatedAt: 2025-08-19T11:21:56.027Z
|
||||
|
||||
}
|
||||
|
||||
❌ DatabaseStorage.updateTask - Database Error: {
|
||||
|
||||
taskId: 99,
|
||||
|
||||
error: 'value.toISOString is not a function',
|
||||
|
||||
cleanData: {
|
||||
|
||||
title: 'test',
|
||||
|
||||
description: 'test',
|
||||
|
||||
priority: 'medium',
|
||||
|
||||
status: 'pending',
|
||||
|
||||
assignedTo: 'test',
|
||||
|
||||
startDate: '2025-08-20',
|
||||
|
||||
dueDate: '2025-08-21',
|
||||
|
||||
updatedAt: 2025-08-19T11:21:56.027Z
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
file:///app/dist/index.js:6700
|
||||
|
||||
taskId: id,
|
||||
|
||||
^
|
||||
|
||||
ReferenceError: id is not defined
|
||||
|
||||
at file:///app/dist/index.js:6700:17
|
||||
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
|
||||
|
||||
Node.js v20.19.4
|
||||
|
||||
Applying DLC migration...
|
||||
|
||||
NOTICE: column "stock_epuise" of relation "dlc_products" already exists, skipping
|
||||
|
||||
NOTICE: column "stock_epuise_by" of relation "dlc_products" already exists, skipping
|
||||
|
||||
NOTICE: column "stock_epuise_at" of relation "dlc_products" already exists, skipping
|
||||
|
||||
NOTICE: relation "idx_dlc_products_stock_epuise" already exists, skipping
|
||||
|
||||
ALTER TABLE
|
||||
|
||||
␍CREATE INDEX
|
||||
|
||||
🔗 Database initialization: {
|
||||
|
||||
NODE_ENV: 'production',
|
||||
|
||||
isProduction: true,
|
||||
|
||||
hasDbUrl: true,
|
||||
|
||||
dbHost: 'logiflow-db'
|
||||
|
||||
}
|
||||
|
||||
🐳 PRODUCTION: Using standard PostgreSQL
|
||||
|
||||
✅ PostgreSQL connection test successful
|
||||
|
||||
🔗 Database initialization: {
|
||||
|
||||
NODE_ENV: 'production',
|
||||
|
||||
isProduction: true,
|
||||
|
||||
hasDbUrl: true,
|
||||
|
||||
dbHost: 'logiflow-db:5432'
|
||||
|
||||
}
|
||||
|
||||
✅ Using DatabaseStorage (production PostgreSQL)
|
||||
|
||||
⏰ Automatic backup scheduled for 2:00 AM daily (native timer)
|
||||
|
||||
🔍 Using development storage and authentication
|
||||
|
||||
🐳 PRODUCTION: Starting LogiFlow application
|
||||
|
||||
🐳 Environment: { NODE_ENV: 'production', DATABASE_URL: 'Present', PORT: '3000' }
|
||||
|
||||
💾 [PRODUCTION] Backup service initialized for automatic daily backups
|
||||
|
||||
🔧 Registering all production routes...
|
||||
|
||||
🔄 Running automatic production migrations...
|
||||
|
||||
🔄 MIGRATION: Starting SAV production migrations...
|
||||
|
||||
🔄 MIGRATION: Database URL configured: postgresql://logiflow_admin:Lo...
|
||||
|
||||
✅ MIGRATION: Connected to PostgreSQL database
|
||||
|
||||
🔄 MIGRATION: Checking if priority column exists...
|
||||
|
||||
🔄 MIGRATION: Priority column check result: 1
|
||||
|
||||
✅ MIGRATION: Priority column already exists, skipping migration
|
||||
|
||||
🔌 MIGRATION: Database connection closed
|
||||
|
||||
🌤️ [PRODUCTION] Initializing weather system...
|
||||
|
||||
🌤️ [AUTO-CONFIG] Initializing weather configuration...
|
||||
|
||||
✅ [AUTO-CONFIG] Weather settings already configured and active
|
||||
|
||||
✅ [PRODUCTION] Weather system initialized
|
||||
|
||||
🌍 Environment detected: production
|
||||
|
||||
🔧 Using memory session store for development
|
||||
|
||||
Warning: connect.session() MemoryStore is not
|
||||
|
||||
designed for a production environment, as it will leak
|
||||
|
||||
memory, and will not scale past a single process.
|
||||
|
||||
✅ All routes registered successfully for production
|
||||
|
||||
🐳 Serving static files from: /app/dist/public
|
||||
|
||||
🐳 PRODUCTION: LogiFlow serving on port 3000
|
||||
|
||||
HEAD /api/health 200 in 8ms
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 56 KiB |
+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