From abeb1e90f5fa277c8b8bf2104342e85dbf67b5b8 Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Fri, 15 Aug 2025 06:41:26 +0000 Subject: [PATCH] Improve data fetching and filtering for admin users Update API calls for deliveries and orders to correctly apply admin role and group ID filtering for enhanced data retrieval. Replit-Commit-Author: Agent Replit-Commit-Session-Id: d43bd811-9372-45a7-8ac9-4a954c0538e1 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/d43bd811-9372-45a7-8ac9-4a954c0538e1/BIZe1t3 --- ...-1-Fetchin-1755240014092_1755240014102.txt | 204 ++++++++++++++++++ 1 file changed, 204 insertions(+) create mode 100644 attached_assets/Pasted-ctions-userRole-admin-Admin-filtering-with-groupIds-1-Fetchin-1755240014092_1755240014102.txt diff --git a/attached_assets/Pasted-ctions-userRole-admin-Admin-filtering-with-groupIds-1-Fetchin-1755240014092_1755240014102.txt b/attached_assets/Pasted-ctions-userRole-admin-Admin-filtering-with-groupIds-1-Fetchin-1755240014092_1755240014102.txt new file mode 100644 index 0000000..dba208b --- /dev/null +++ b/attached_assets/Pasted-ctions-userRole-admin-Admin-filtering-with-groupIds-1-Fetchin-1755240014092_1755240014102.txt @@ -0,0 +1,204 @@ +ctions + + + + + userRole: 'admin' + +} + +Admin filtering with groupIds: [ 1 ] + +Fetching all orders + +🔗 PRODUCTION: getDeliveries() récupéré 44 livraisons avec relations + +Deliveries returned: 44 items + +Customer Orders returned: 9 items + +GET /api/deliveries 304 in 124ms + +GET /api/customer-orders 304 in 116ms + +🔗 PRODUCTION: getOrders() récupéré 31 commandes avec relations + +Orders returned: 31 items + +GET /api/orders 304 in 148ms + +GET /api/groups 304 in 95ms + +GET /api/publicities 304 in 140ms + +🌤️ Fetching previous year weather data from API + +Weather API error for previous year: 401 + +GET /api/weather/current 200 in 886ms + +GET /api/user 304 in 5ms + +GET /api/user 304 in 4ms + +GET /api/backups 304 in 8ms + +GET /api/weather/settings 200 in 4ms + +HEAD /api/health 200 in 1ms + +PUT /api/weather/settings/1 200 in 11ms + +GET /api/weather/settings 200 in 4ms + +GET /api/user 304 in 12ms + +GET /api/publicities 304 in 32ms + +Deliveries API called with: { + + startDate: undefined, + + endDate: undefined, + + storeId: '1', + + withBL: undefined, + + userRole: 'admin' + +} + +Admin filtering deliveries with groupIds: [ 1 ] + +Fetching all deliveries + +📊 Calcul statistiques mensuelles: { + + year: 2025, + + month: 8, + + startDate: '2025-08-01', + + endDate: '2025-09-01', + + groupIds: undefined + +} + +🔗 PRODUCTION: getDeliveries() récupéré 44 livraisons avec relations + +Deliveries returned: 44 items + +GET /api/deliveries 304 in 168ms + +Orders API called with: { + + startDate: undefined, + + endDate: undefined, + + storeId: undefined, + + userRole: 'admin' + +} + +Admin filtering with groupIds: undefined + +Fetching all orders + +Customer Orders API called with: { groupIds: undefined, userRole: 'admin' } + +Orders API called with: { + + startDate: undefined, + + endDate: undefined, + + storeId: '1', + + userRole: 'admin' + +} + +Admin filtering with groupIds: [ 1 ] + +Fetching all orders + +Tasks API called with: { groupIds: undefined, userRole: 'admin' } + +Customer Orders API called with: { groupIds: [ 1 ], userRole: 'admin' } + +🔗 PRODUCTION: getOrders() récupéré 49 commandes avec relations + +Orders returned: 49 items + +GET /api/orders 304 in 336ms + +📊 Statistiques calculées: { + + ordersCount: 18, + + deliveriesCount: 42, + + pendingOrdersCount: 6, + + averageDeliveryTime: 0.3611111111111111, + + totalPalettes: 120, + + totalPackages: 36 + +} + +Deliveries API called with: { + + startDate: undefined, + + endDate: undefined, + + storeId: undefined, + + withBL: undefined, + + userRole: 'admin' + +} + +Admin filtering deliveries with groupIds: undefined + +Fetching all deliveries + +GET /api/stats/monthly 304 in 364ms + +GET /api/dlc-products/stats 304 in 351ms + +Tasks returned: 61 items + +Customer Orders returned: 36 items + +Customer Orders returned: 9 items + +GET /api/tasks 304 in 361ms + +GET /api/customer-orders 304 in 373ms + +GET /api/customer-orders 304 in 331ms + +🔗 PRODUCTION: getOrders() récupéré 31 commandes avec relations + +Orders returned: 31 items + +GET /api/orders 304 in 370ms + +🔗 PRODUCTION: getDeliveries() récupéré 82 livraisons avec relations + +Deliveries returned: 82 items + +GET /api/deliveries 304 in 456ms + +GET /api/publicities 304 in 400ms + +HEAD /api/health 200 in 2ms \ No newline at end of file