diff --git a/attached_assets/Pasted--GET-api-user-304-in-102ms-Customer-Orders-API-called-with-groupIds-undefined-user-1755166953546_1755166953546.txt b/attached_assets/Pasted--GET-api-user-304-in-102ms-Customer-Orders-API-called-with-groupIds-undefined-user-1755166953546_1755166953546.txt new file mode 100644 index 0000000..fa4ebc6 --- /dev/null +++ b/attached_assets/Pasted--GET-api-user-304-in-102ms-Customer-Orders-API-called-with-groupIds-undefined-user-1755166953546_1755166953546.txt @@ -0,0 +1,199 @@ + + +GET /api/user 304 in 102ms + +Customer Orders API called with: { groupIds: undefined, userRole: 'admin' } + +📊 Calcul statistiques mensuelles: { + + year: 2025, + + month: 8, + + startDate: '2025-08-01', + + endDate: '2025-09-01', + + groupIds: undefined + +} + +Deliveries API called with: { + + startDate: undefined, + + endDate: undefined, + + storeId: undefined, + + withBL: undefined, + + userRole: 'admin' + +} + +Admin filtering deliveries with groupIds: undefined + +Fetching all deliveries + +Tasks API called with: { groupIds: undefined, userRole: 'admin' } + +🔗 PRODUCTION: getOrders() récupéré 49 commandes avec relations + +Orders returned: 49 items + +GET /api/dlc-products/stats 304 in 181ms + +GET /api/orders 200 in 188ms + +Customer Orders returned: 34 items + +GET /api/customer-orders 200 in 192ms + +GET /api/publicities 304 in 188ms + +📊 Statistiques calculées: { + + ordersCount: 18, + + deliveriesCount: 42, + + pendingOrdersCount: 5, + + averageDeliveryTime: 0.3611111111111111, + + totalPalettes: 120, + + totalPackages: 36 + +} + +Tasks returned: 61 items + +GET /api/stats/monthly 200 in 229ms + +GET /api/tasks 304 in 221ms + +GET /api/user 304 in 28ms + +🔗 PRODUCTION: getDeliveries() récupéré 82 livraisons avec relations + +Deliveries returned: 82 items + +GET /api/deliveries 200 in 282ms + +Deliveries API called with: { + + startDate: undefined, + + endDate: undefined, + + storeId: '2', + + withBL: undefined, + + userRole: 'admin' + +} + +Admin filtering deliveries with groupIds: [ 2 ] + +Fetching all deliveries + +Orders API called with: { + + startDate: undefined, + + endDate: undefined, + + storeId: '2', + + userRole: 'admin' + +} + +Admin filtering with groupIds: [ 2 ] + +Fetching all orders + +Customer Orders API called with: { groupIds: [ 2 ], userRole: 'admin' } + +🔗 PRODUCTION: getDeliveries() récupéré 38 livraisons avec relations + +Deliveries returned: 38 items + +GET /api/deliveries 304 in 67ms + +Customer Orders returned: 25 items + +GET /api/customer-orders 200 in 63ms + +🔗 PRODUCTION: getOrders() récupéré 18 commandes avec relations + +Orders returned: 18 items + +GET /api/orders 304 in 63ms + +GET /api/groups 304 in 6ms + +GET /api/publicities 304 in 17ms + +GET /api/user 304 in 6ms + +GET /api/suppliers 304 in 12ms + +GET /api/sav/stats 304 in 21ms + +GET /api/sav/tickets 304 in 26ms + +HEAD /api/health 200 in 1ms + +POST /api/sav/tickets 500 in 17ms + +Error creating SAV ticket: error: new row for relation "sav_ticket_history" violates check constraint "chk_sav_history_action" + + at /app/node_modules/pg-pool/index.js:45:11 + + at process.processTicksAndRejections (node:internal/process/task_queues:95:5) + + at async file:///app/node_modules/drizzle-orm/node-postgres/session.js:83:22 + + at async DatabaseStorage.addSavTicketHistory (file:///app/dist/index.js:2040:27) + + at async DatabaseStorage.createSavTicket (file:///app/dist/index.js:2013:9) + + at async file:///app/dist/index.js:6154:22 { + + length: 336, + + severity: 'ERROR', + + code: '23514', + + detail: 'Failing row contains (32, 11, ticket_created, Ticket créé avec le statut "nouveau", admin_local, 2025-08-14 10:22:10.723558).', + + hint: undefined, + + position: undefined, + + internalPosition: undefined, + + internalQuery: undefined, + + where: undefined, + + schema: 'public', + + table: 'sav_ticket_history', + + column: undefined, + + dataType: undefined, + + constraint: 'chk_sav_history_action', + + file: 'execMain.c', + + line: '2023', + + routine: 'ExecConstraints' \ No newline at end of file diff --git a/attached_assets/{061DD707-8F0A-47F0-BD8E-D54E92CDB471}_1755166934662.png b/attached_assets/{061DD707-8F0A-47F0-BD8E-D54E92CDB471}_1755166934662.png new file mode 100644 index 0000000..7bda5b6 Binary files /dev/null and b/attached_assets/{061DD707-8F0A-47F0-BD8E-D54E92CDB471}_1755166934662.png differ diff --git a/server/storage.ts b/server/storage.ts index d4d8a6f..796022d 100644 --- a/server/storage.ts +++ b/server/storage.ts @@ -1629,7 +1629,7 @@ export class DatabaseStorage implements IStorage { // Add initial history entry await this.addSavTicketHistory({ ticketId: ticket.id, - action: 'ticket_created', + action: 'created', description: `Ticket créé avec le statut "${ticket.status}"`, createdBy: ticket.createdBy, }); @@ -2822,7 +2822,7 @@ export class MemStorage implements IStorage { // Add initial history entry await this.addSavTicketHistory({ ticketId: id, - action: 'ticket_created', + action: 'created', description: `Ticket créé avec le statut "${ticket.status}"`, createdBy: ticket.createdBy, }); @@ -3034,28 +3034,28 @@ export class MemStorage implements IStorage { // Add history entries for each ticket const histories = [ // Ticket 1 history - { ticketId: 1, action: 'ticket_created', description: 'Ticket créé avec le statut "nouveau"', createdBy: 'admin', createdAt: new Date('2025-08-10T08:30:00') }, + { ticketId: 1, action: 'created', description: 'Ticket créé avec le statut "nouveau"', createdBy: 'admin', createdAt: new Date('2025-08-10T08:30:00') }, // Ticket 2 history - { ticketId: 2, action: 'ticket_created', description: 'Ticket créé avec le statut "nouveau"', createdBy: 'admin', createdAt: new Date('2025-08-09T14:15:00') }, + { ticketId: 2, action: 'created', description: 'Ticket créé avec le statut "nouveau"', createdBy: 'admin', createdAt: new Date('2025-08-09T14:15:00') }, { ticketId: 2, action: 'status_change', description: 'Statut changé de "nouveau" vers "en_cours"', createdBy: 'admin', createdAt: new Date('2025-08-12T10:20:00') }, { ticketId: 2, action: 'comment', description: 'Contact avec le client pour confirmer les pièces manquantes. Commande des accessoires en cours.', createdBy: 'admin', createdAt: new Date('2025-08-12T10:25:00') }, // Ticket 3 history - { ticketId: 3, action: 'ticket_created', description: 'Ticket créé avec le statut "nouveau"', createdBy: 'admin', createdAt: new Date('2025-08-08T09:45:00') }, + { ticketId: 3, action: 'created', description: 'Ticket créé avec le statut "nouveau"', createdBy: 'admin', createdAt: new Date('2025-08-08T09:45:00') }, { ticketId: 3, action: 'status_change', description: 'Statut changé de "nouveau" vers "en_cours"', createdBy: 'admin', createdAt: new Date('2025-08-10T14:00:00') }, { ticketId: 3, action: 'status_change', description: 'Statut changé de "en_cours" vers "attente_pieces"', createdBy: 'admin', createdAt: new Date('2025-08-13T16:30:00') }, { ticketId: 3, action: 'comment', description: 'Écran de remplacement commandé. Délai annoncé de 5-7 jours ouvrables.', createdBy: 'admin', createdAt: new Date('2025-08-13T16:35:00') }, // Ticket 4 history - { ticketId: 4, action: 'ticket_created', description: 'Ticket créé avec le statut "nouveau"', createdBy: 'admin', createdAt: new Date('2025-08-05T11:20:00') }, + { ticketId: 4, action: 'created', description: 'Ticket créé avec le statut "nouveau"', createdBy: 'admin', createdAt: new Date('2025-08-05T11:20:00') }, { ticketId: 4, action: 'status_change', description: 'Statut changé de "nouveau" vers "en_cours"', createdBy: 'admin', createdAt: new Date('2025-08-06T09:00:00') }, { ticketId: 4, action: 'comment', description: 'Diagnostic effectué : problème de connectivité Bluetooth. Réparation en cours.', createdBy: 'admin', createdAt: new Date('2025-08-07T15:30:00') }, { ticketId: 4, action: 'status_change', description: 'Statut changé de "en_cours" vers "resolu"', createdBy: 'admin', createdAt: new Date('2025-08-14T08:00:00') }, { ticketId: 4, action: 'comment', description: 'Casque réparé avec succès. Module Bluetooth remplacé. Tests complets effectués.', createdBy: 'admin', createdAt: new Date('2025-08-14T08:05:00') }, // Ticket 5 history - { ticketId: 5, action: 'ticket_created', description: 'Ticket créé avec le statut "nouveau"', createdBy: 'admin', createdAt: new Date('2025-08-14T07:30:00') }, + { ticketId: 5, action: 'created', description: 'Ticket créé avec le statut "nouveau"', createdBy: 'admin', createdAt: new Date('2025-08-14T07:30:00') }, { ticketId: 5, action: 'status_change', description: 'Statut changé de "nouveau" vers "en_cours"', createdBy: 'admin', createdAt: new Date('2025-08-14T07:30:00') }, { ticketId: 5, action: 'comment', description: 'Priorité critique - Intervention d\'urgence programmée pour ce matin.', createdBy: 'admin', createdAt: new Date('2025-08-14T07:35:00') }, ];