Merge pull request #336 from R0m1k3/1.1

1.1
This commit is contained in:
LogiFlow authored and GitHub committed 2025-09-03 14:54:29 +02:00
commit 07202f66c2
5 files changed
+411 -5

No files matched your search

+1 -1
View File
@@ -37,4 +37,4 @@ args = "npm run dev"
waitForPort = 5000
[agent]
integrations = ["javascript_log_in_with_replit==1.0.0", "javascript_object_storage==1.0.0", "javascript_database==1.0.0"]
integrations = ["javascript_object_storage==1.0.0", "javascript_database==1.0.0", "javascript_log_in_with_replit==1.0.0"]
@@ -0,0 +1,199 @@
🎯 [PRODUCTION] Using PostgreSQL DASHBOARD_MESSAGES table
🔍 [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 8ms
GET /api/groups 200 in 4ms
GET /api/user 304 in 7ms
📊 Calcul statistiques mensuelles: {
year: 2025,
month: 9,
startDate: '2025-09-01',
endDate: '2025-10-01',
groupIds: [ 1 ]
}
Orders API called with: {
startDate: '2025-09-01',
endDate: '2025-09-30',
storeId: '1',
userRole: 'manager'
}
🔍 Non-admin orders - filtering by accessible store: { userId: '_1754943032954', role: 'manager', requestedStoreId: 1 }
Deliveries API called with: {
startDate: '2025-09-01',
endDate: '2025-09-30',
storeId: '1',
withBL: undefined,
userRole: 'manager'
}
🔍 Non-admin deliveries - filtering by accessible store: { userId: '_1754943032954', role: 'manager', requestedStoreId: 1 }
📋 API PUBLICITIES REQUEST: {
year: '2025',
filterYear: 2025,
storeId: undefined,
userRole: 'manager'
}
📋 CALLING storage.getPublicities: { filterYear: 2025, groupIds: [ 1 ] }
📋 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 22ms
📊 Statistiques calculées: {
ordersCount: 12,
deliveriesCount: 10,
pendingOrdersCount: 10,
averageDeliveryTime: 3.6666666666666665,
totalPalettes: 29,
totalPackages: 3
}
GET /api/stats/monthly 200 in 31ms
Orders returned: 12 items
GET /api/orders 200 in 33ms
Deliveries returned: 10 items
GET /api/deliveries 304 in 34ms
GET /api/user 304 in 5ms
GET /api/user 304 in 3ms
HEAD /api/health 200 in 1ms
Orders API called with: {
startDate: undefined,
endDate: undefined,
storeId: undefined,
userRole: 'manager'
}
🔍 Manager orders - using assigned store automatically: {
userId: '_1754943032954',
role: 'manager',
assignedStore: 1,
allUserGroups: [ 1 ]
}
GET /api/suppliers 200 in 8ms
GET /api/user 304 in 9ms
🔗 PRODUCTION: getOrders() récupéré 56 commandes avec relations
Orders returned: 56 items
@@ -0,0 +1,204 @@
endDate: '2025-09-30',
storeId: '1',
userRole: 'manager'
}
🔍 Non-admin orders - filtering by accessible store: { userId: '_1754943032954', role: 'manager', requestedStoreId: 1 }
Deliveries API called with: {
startDate: '2025-09-01',
endDate: '2025-09-30',
storeId: '1',
withBL: undefined,
userRole: 'manager'
}
🔍 Non-admin deliveries - filtering by accessible store: { userId: '_1754943032954', role: 'manager', requestedStoreId: 1 }
📋 API PUBLICITIES REQUEST: {
year: '2025',
filterYear: 2025,
storeId: undefined,
userRole: 'manager'
}
📋 CALLING storage.getPublicities: { filterYear: 2025, groupIds: [ 1 ] }
📋 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 22ms
📊 Statistiques calculées: {
ordersCount: 12,
deliveriesCount: 10,
pendingOrdersCount: 10,
averageDeliveryTime: 3.6666666666666665,
totalPalettes: 29,
totalPackages: 3
}
GET /api/stats/monthly 200 in 31ms
Orders returned: 12 items
GET /api/orders 200 in 33ms
Deliveries returned: 10 items
GET /api/deliveries 304 in 34ms
GET /api/user 304 in 5ms
GET /api/user 304 in 3ms
HEAD /api/health 200 in 1ms
Orders API called with: {
startDate: undefined,
endDate: undefined,
storeId: undefined,
userRole: 'manager'
}
🔍 Manager orders - using assigned store automatically: {
userId: '_1754943032954',
role: 'manager',
assignedStore: 1,
allUserGroups: [ 1 ]
}
GET /api/suppliers 200 in 8ms
GET /api/user 304 in 9ms
🔗 PRODUCTION: getOrders() récupéré 56 commandes avec relations
Orders returned: 56 items
GET /api/orders 304 in 84ms
HEAD /api/health 200 in 1ms
HEAD /api/health 200 in 0ms
HEAD /api/health 200 in 0ms
HEAD /api/health 200 in 1ms
🔍 BAP: Requête reçue {
hasUser: true,
userType: 'object',
hasClaims: false,
hasId: true,
bodyKeys: [ 'pdfBase64', 'fileName', 'recipient' ]
}
🔍 BAP: User ID extracted: admin_local
🔍 BAP: User found: { id: 'admin_local', role: 'admin' }
📤 BAP: Envoi webhook n8n {
recipient: 'Prissela',
fileName: '20250903_113707.pdf',
fileSize: 344773,
userId: 'admin_local'
}
✅ BAP: Payload JSON préparé {
recipient: 'Prissela',
fileName: '20250903_113707.pdf',
fileSize: 344773
}
🌐 BAP: Envoi vers webhook n8n...
🌐 BAP: Réponse webhook reçue { status: 404, ok: false }
❌ BAP: Erreur webhook {
status: 404,
errorText: '{"code":404,"message":"This webhook is not registered for POST requests. Did you mean to make a GET request?"}'
}
❌ BAP: Erreur complète: {
name: 'Error',
message: 'Erreur webhook: 404 Not Found',
stack: 'Error: Erreur webhook: 404 Not Found\n' +
' at file:///app/dist/index.js:12408:15\n' +
' at process.processTicksAndRejections (node:internal/process/task_queues:95:5)'
}
POST /api/bap/send-webhook 500 in 41ms
HEAD /api/health 200 in 1ms
Binary file not shown.

After

Width:  |  Height:  |  Size: 385 KiB

+7 -4
View File
@@ -149,14 +149,17 @@ export async function registerRoutes(app: Express): Promise<Server> {
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), 60000); // 60 secondes
console.log('🌐 BAP: Envoi vers webhook n8n...');
console.log('🌐 BAP: Envoi vers webhook n8n (GET)...');
const response = await fetch(webhookUrl, {
method: 'POST',
method: 'GET',
headers: {
'Content-Type': 'application/json'
'Content-Type': 'application/json',
'X-PDF-Base64': pdfBase64,
'X-Recipient': recipient,
'X-FileName': fileName,
'X-FileSize': fileBuffer.length.toString()
},
body: JSON.stringify(webhookPayload),
signal: controller.signal
});