diff --git a/attached_assets/Pasted-Actions-PUBLICITES-FETCHED-29-r-sultats-pour-ann-e-2025-PREMIERS-RESULTA-1757344536840_1757344536841.txt b/attached_assets/Pasted-Actions-PUBLICITES-FETCHED-29-r-sultats-pour-ann-e-2025-PREMIERS-RESULTA-1757344536840_1757344536841.txt new file mode 100644 index 0000000..4f610c2 --- /dev/null +++ b/attached_assets/Pasted-Actions-PUBLICITES-FETCHED-29-r-sultats-pour-ann-e-2025-PREMIERS-RESULTA-1757344536840_1757344536841.txt @@ -0,0 +1,202 @@ +Actions + + + + +📋 PUBLICITES FETCHED: 29 résultats pour année 2025 + +🔍 PREMIERS RESULTATS: [ + + '1. N°2501 - Blanc', + + '2. N°2502 - Moins de 1€ 2€ 3€ 4€ 5€', + + '3. N°2503 - Imbattables' + +] + +📋 PUBLICITIES RETURNED: { count: 29 } + +GET /api/publicities 304 in 65ms + +🔍 [PRODUCTION] Raw messages from DB: 2 items: [ + + { + + id: 16, + + title: 'Mise à jour Prix', + + content: 'Merci de mettre vos prix a jour tous les matins, certain magasin ne le font pas.', + + type: 'success', + + storeId: null, + + createdBy: 'admin', + + createdAt: 2025-08-18T10:45:08.585Z + + }, + + { + + id: 8, + + title: 'Bon de Livraison', + + content: 'Lorsque vous rentrez un numéro de bon de livraison, faite le a l identique, même les majuscules. Pour My candy Shop, prendre le numéro de commande.', + + type: 'info', + + storeId: null, + + createdBy: 'admin_local', + + createdAt: 2025-08-07T11:04:38.123Z + + } + +] + +🔍 [PRODUCTION] Looking for user with username: admin + +🔍 [PRODUCTION] Looking for user with username: admin_local + +🔍 [PRODUCTION] User search result: Found + +🔍 [PRODUCTION] User search result: Not found + +❌ [PRODUCTION] User not found with username: admin_local + +🎯 [PRODUCTION] Found announcements: 2 + +GET /api/announcements 304 in 79ms + +GET /api/user 304 in 3ms + +Orders API called with: { + + startDate: undefined, + + endDate: undefined, + + storeId: '1', + + userRole: 'admin' + +} + +🔍 Admin orders filtering by store: { storeId: '1', groupIds: [ 1 ], role: 'admin' } + +Fetching all orders + +📢 [SERVER] Fetching announcements for user: admin_local environment: production + +Deliveries API called with: { + + startDate: undefined, + + endDate: undefined, + + storeId: '1', + + withBL: undefined, + + userRole: 'admin' + +} + +🔍 Admin deliveries filtering by store: { storeId: '1', groupIds: [ 1 ], role: 'admin' } + +Fetching all deliveries + +🔗 PRODUCTION: getOrders() récupéré 64 commandes avec relations + +Orders returned: 64 items + +GET /api/orders 304 in 184ms + +Customer Orders API called with: { groupIds: [ 1 ], userRole: 'admin' } + +📢 [SERVER] User found: { username: 'admin', role: 'admin' } + +🎯 [PRODUCTION] Using PostgreSQL DASHBOARD_MESSAGES table + +Customer Orders returned: 11 items + +GET /api/customer-orders 304 in 211ms + +🔍 [PRODUCTION] Raw messages from DB: 2 items: [ + + { + + id: 16, + + title: 'Mise à jour Prix', + + content: 'Merci de mettre vos prix a jour tous les matins, certain magasin ne le font pas.', + + type: 'success', + + storeId: null, + + createdBy: 'admin', + + createdAt: 2025-08-18T10:45:08.585Z + + }, + + { + + id: 8, + + title: 'Bon de Livraison', + + content: 'Lorsque vous rentrez un numéro de bon de livraison, faite le a l identique, même les majuscules. Pour My candy Shop, prendre le numéro de commande.', + + type: 'info', + + storeId: null, + + createdBy: 'admin_local', + + createdAt: 2025-08-07T11:04:38.123Z + + } + +] + +🔍 [PRODUCTION] Looking for user with username: admin + +🔍 [PRODUCTION] Looking for user with username: admin_local + +GET /api/groups 304 in 96ms + +🔍 [PRODUCTION] User search result: Found + +🔍 [PRODUCTION] User search result: Not found + +🎯 [PRODUCTION] Found announcements: 2 + +❌ [PRODUCTION] User not found with username: admin_local + +GET /api/announcements 304 in 243ms + +🔗 PRODUCTION: getDeliveries() récupéré 82 livraisons avec relations + +Deliveries returned: 82 items + +GET /api/deliveries 304 in 251ms + +GET /api/user 304 in 4ms + +GET /api/suppliers 304 in 8ms + +🔍 Avoirs API called with: { groupIds: undefined, userRole: 'admin' } + +📋 Avoirs returned: 0 items + +GET /api/avoirs 304 in 13ms + +POST /api/avoirs 400 in 6ms \ No newline at end of file diff --git a/attached_assets/{9F81C70E-566B-4181-89ED-BA22062981D4}_1757344517180.png b/attached_assets/{9F81C70E-566B-4181-89ED-BA22062981D4}_1757344517180.png new file mode 100644 index 0000000..874ca2b Binary files /dev/null and b/attached_assets/{9F81C70E-566B-4181-89ED-BA22062981D4}_1757344517180.png differ diff --git a/server/routes.ts b/server/routes.ts index 1a46e9f..f15523f 100644 --- a/server/routes.ts +++ b/server/routes.ts @@ -2409,12 +2409,18 @@ export async function registerRoutes(app: Express): Promise { return res.status(404).json({ message: "User not found" }); } + // DEBUG: Log des données reçues + console.log('🔍 [POST AVOIR] Données reçues:', JSON.stringify(req.body, null, 2)); + console.log('🔍 [POST AVOIR] User:', { id: user.id, role: user.role }); + // Validate data with Zod schema const validatedData = insertAvoirSchema.parse({ ...req.body, createdBy: user.id, }); + console.log('✅ [POST AVOIR] Données validées:', JSON.stringify(validatedData, null, 2)); + // Check if user has access to the specified group if (user.role !== 'admin' && user.role !== 'directeur') { const userGroupIds = user.userGroups.map(ug => ug.groupId);