mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
Improve date handling for delivery due dates
Correctly normalize and convert delivery due dates to Date objects for database storage, resolving a TypeError. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 1e4433b5-47ab-464c-b663-fea2e53367dd Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 4d4c67ad-e680-477f-bb7e-e952e806558e Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/1e4433b5-47ab-464c-b663-fea2e53367dd/Tx7N1IN
This commit is contained in:
1 parent
e328993329
commit
257932686f
3 files changed
+214
-4
No files matched your search
+201
@@ -0,0 +1,201 @@
|
||||
|
||||
|
||||
✅ PRODUCTION: getDelivery #427 found associated order #256 with status: delivered
|
||||
|
||||
🔄 Updating delivery: { id: 427, data: { invoiceReference: '197771' }, user: 'admin_local' }
|
||||
|
||||
🔍 [INVOICE] Début vérification facture: { invoiceReference: '197771', groupId: 1, forceRefresh: true }
|
||||
|
||||
🔄 [INVOICE] Refresh forcé, ignorant le cache
|
||||
|
||||
🔧 Configuration groupe: {
|
||||
|
||||
groupName: 'Frouard',
|
||||
|
||||
hasNocodbConfig: true,
|
||||
|
||||
hasTableName: true,
|
||||
|
||||
hasWebhook: true
|
||||
|
||||
}
|
||||
|
||||
🔍 Vérification NocoDB en production...
|
||||
|
||||
🔧 Configuration NocoDB active récupérée: {
|
||||
|
||||
id: 1,
|
||||
|
||||
name: 'Nocodb',
|
||||
|
||||
baseUrl: 'https://nocodb.ffnancy.fr',
|
||||
|
||||
projectId: 'pcg4uw79ukvycxc',
|
||||
|
||||
apiToken: 'z4BAwLo6dgoN_E7PKJSHN7PA7kdBePtKOYcsDlwQ',
|
||||
|
||||
description: '',
|
||||
|
||||
isActive: true,
|
||||
|
||||
createdBy: 'admin_local',
|
||||
|
||||
createdAt: 2025-07-22T11:12:54.971Z,
|
||||
|
||||
updatedAt: 2025-07-25T23:07:17.197Z
|
||||
|
||||
}
|
||||
|
||||
🔧 Configuration NocoDB trouvée: {
|
||||
|
||||
configName: 'Nocodb',
|
||||
|
||||
baseUrl: 'https://nocodb.ffnancy.fr',
|
||||
|
||||
projectId: 'pcg4uw79ukvycxc',
|
||||
|
||||
hasToken: true
|
||||
|
||||
}
|
||||
|
||||
🔧 Utilisation table ID: {
|
||||
|
||||
groupTable: 'CommandeF',
|
||||
|
||||
configuredId: 'mrr733dfb8wtt9b',
|
||||
|
||||
resolvedId: 'mrr733dfb8wtt9b'
|
||||
|
||||
}
|
||||
|
||||
🔍 Recherche NocoDB: { tableId: 'mrr733dfb8wtt9b', column: 'RefFacture' }
|
||||
|
||||
💾 [CACHE] Tentative sauvegarde: {
|
||||
|
||||
invoiceReference: '197771',
|
||||
|
||||
groupId: 1,
|
||||
|
||||
cacheKey: '1_197771',
|
||||
|
||||
exists: true,
|
||||
|
||||
isReconciled: false,
|
||||
|
||||
cacheType: 'temporaire 6h (trouvé)',
|
||||
|
||||
expiresAt: '2025-11-03T23:28:12.943Z'
|
||||
|
||||
}
|
||||
|
||||
Error updating delivery: TypeError: value.toISOString is not a function
|
||||
|
||||
at PgTimestamp.mapToDriverValue (file:///app/node_modules/drizzle-orm/pg-core/columns/timestamp.js:34:18)
|
||||
|
||||
at file:///app/node_modules/drizzle-orm/sql/sql.js:131:73
|
||||
|
||||
at Array.map (<anonymous>)
|
||||
|
||||
at SQL.buildQueryFromSourceParams (file:///app/node_modules/drizzle-orm/sql/sql.js:73:32)
|
||||
|
||||
at file:///app/node_modules/drizzle-orm/sql/sql.js:95:21
|
||||
|
||||
at Array.map (<anonymous>)
|
||||
|
||||
at SQL.buildQueryFromSourceParams (file:///app/node_modules/drizzle-orm/sql/sql.js:73:32)
|
||||
|
||||
at file:///app/node_modules/drizzle-orm/sql/sql.js:95:21
|
||||
|
||||
at Array.map (<anonymous>)
|
||||
|
||||
at SQL.buildQueryFromSourceParams (file:///app/node_modules/drizzle-orm/sql/sql.js:73:32)
|
||||
|
||||
✅ [CACHE] Résultat sauvé en cache: {
|
||||
|
||||
␍ id: 31803,
|
||||
|
||||
invoiceReference: '197771',
|
||||
|
||||
groupId: 1,
|
||||
|
||||
exists: true,
|
||||
|
||||
isReconciled: false,
|
||||
|
||||
cacheType: 'temporaire 6h (trouvé)',
|
||||
|
||||
cacheKey: '1_197771'
|
||||
|
||||
}
|
||||
|
||||
📅 Date d'échéance récupérée et normalisée: 2025-11-29 (original: 2025-11-29)
|
||||
|
||||
PUT /api/deliveries/427 500 in 339ms
|
||||
|
||||
🔍 Recherche NocoDB: { tableId: 'mrr733dfb8wtt9b', column: 'Numero_BL' }
|
||||
|
||||
💾 [CACHE] Tentative sauvegarde: {
|
||||
|
||||
invoiceReference: '197771',
|
||||
|
||||
groupId: 1,
|
||||
|
||||
cacheKey: '1_197771',
|
||||
|
||||
exists: true,
|
||||
|
||||
isReconciled: false,
|
||||
|
||||
cacheType: 'temporaire 6h (trouvé)',
|
||||
|
||||
expiresAt: '2025-11-03T23:28:12.963Z'
|
||||
|
||||
}
|
||||
|
||||
✅ [CACHE] Résultat sauvé en cache: {
|
||||
|
||||
␍ id: 31803,
|
||||
|
||||
invoiceReference: '197771',
|
||||
|
||||
groupId: 1,
|
||||
|
||||
exists: true,
|
||||
|
||||
isReconciled: false,
|
||||
|
||||
cacheType: 'temporaire 6h (trouvé)',
|
||||
|
||||
cacheKey: '1_197771'
|
||||
|
||||
}
|
||||
|
||||
📅 Date d'échéance récupérée et normalisée: 2025-11-29 (original: 2025-11-29)
|
||||
|
||||
Error updating delivery: TypeError: value.toISOString is not a function
|
||||
|
||||
at PgTimestamp.mapToDriverValue (file:///app/node_modules/drizzle-orm/pg-core/columns/timestamp.js:34:18)
|
||||
|
||||
at file:///app/node_modules/drizzle-orm/sql/sql.js:131:73
|
||||
|
||||
at Array.map (<anonymous>)
|
||||
|
||||
at SQL.buildQueryFromSourceParams (file:///app/node_modules/drizzle-orm/sql/sql.js:73:32)
|
||||
|
||||
at file:///app/node_modules/drizzle-orm/sql/sql.js:95:21
|
||||
|
||||
at Array.map (<anonymous>)
|
||||
|
||||
at SQL.buildQueryFromSourceParams (file:///app/node_modules/drizzle-orm/sql/sql.js:73:32)
|
||||
|
||||
at file:///app/node_modules/drizzle-orm/sql/sql.js:95:21
|
||||
|
||||
at Array.map (<anonymous>)
|
||||
|
||||
at SQL.buildQueryFromSourceParams (file:///app/node_modules/drizzle-orm/sql/sql.js:73:32)
|
||||
|
||||
PUT /api/deliveries/427 500 in 50ms
|
||||
|
||||
HEAD /api/health 200 in 1ms
|
||||
|
||||
HEAD /api/health 200 in 1ms
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
+13
-4
@@ -415,8 +415,10 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
||||
|
||||
if (result.exists && result.dueDate) {
|
||||
// Normaliser la date avant de la stocker
|
||||
const normalizedDate = normalizeDateString(result.dueDate);
|
||||
if (normalizedDate) {
|
||||
const normalizedDateString = normalizeDateString(result.dueDate);
|
||||
if (normalizedDateString) {
|
||||
// Convertir la string normalisée en objet Date pour Drizzle
|
||||
const normalizedDate = new Date(normalizedDateString);
|
||||
// Mettre à jour deliveries avec la date normalisée (caching)
|
||||
await storage.updateDelivery(delivery.id, { dueDate: normalizedDate });
|
||||
delivery.dueDate = normalizedDate;
|
||||
@@ -1449,8 +1451,15 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
||||
|
||||
if (result.exists && result.dueDate) {
|
||||
// Normaliser la date avant de la stocker
|
||||
data.dueDate = normalizeDateString(result.dueDate);
|
||||
console.log(`📅 Date d'échéance récupérée et normalisée: ${data.dueDate} (original: ${result.dueDate})`);
|
||||
const normalizedDateString = normalizeDateString(result.dueDate);
|
||||
if (normalizedDateString) {
|
||||
// Convertir la string normalisée en objet Date pour Drizzle
|
||||
data.dueDate = new Date(normalizedDateString);
|
||||
console.log(`📅 Date d'échéance récupérée et normalisée: ${normalizedDateString} (original: ${result.dueDate})`);
|
||||
} else {
|
||||
data.dueDate = null;
|
||||
console.log(`📅 Date d'échéance invalide, ignorée`);
|
||||
}
|
||||
} else {
|
||||
data.dueDate = null;
|
||||
console.log(`📅 Aucune date d'échéance trouvée dans NocoDB`);
|
||||
|
||||
Reference in new issue
Block a user