diff --git a/.replit b/.replit index 2e1a3ae..853b5d3 100644 --- a/.replit +++ b/.replit @@ -37,4 +37,4 @@ args = "npm run dev" waitForPort = 5000 [agent] -integrations = ["javascript_object_storage==1.0.0", "javascript_database==1.0.0", "javascript_log_in_with_replit==1.0.0"] +integrations = ["javascript_database==1.0.0", "javascript_object_storage==1.0.0", "javascript_log_in_with_replit==1.0.0"] diff --git a/attached_assets/Pasted--storeId-null-createdBy-admin-createdAt-2025-08-18T10-45-08-585Z--1756908108277_1756908108278.txt b/attached_assets/Pasted--storeId-null-createdBy-admin-createdAt-2025-08-18T10-45-08-585Z--1756908108277_1756908108278.txt new file mode 100644 index 0000000..186d9ed --- /dev/null +++ b/attached_assets/Pasted--storeId-null-createdBy-admin-createdAt-2025-08-18T10-45-08-585Z--1756908108277_1756908108278.txt @@ -0,0 +1,201 @@ + + + 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 + +Customer Orders API called with: { groupIds: [ 1 ], userRole: 'admin' } + +🔍 [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 103ms + +Customer Orders returned: 7 items + +GET /api/customer-orders 304 in 108ms + +🔗 PRODUCTION: getDeliveries() récupéré 72 livraisons avec relations + +Deliveries returned: 72 items + +GET /api/deliveries 304 in 171ms + +GET /api/groups 304 in 109ms + +GET /api/user 304 in 4ms + +GET /api/user 304 in 6ms + +GET /api/backups 304 in 8ms + +⚠️ Table webhook_bap_config n'existe pas, retour config par défaut + +GET /api/webhook-bap-config 304 in 7ms + +❌ Erreur récupération config webhook BAP: error: relation "webhook_bap_config" does not exist + + 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.getWebhookBapConfig (file:///app/dist/index.js:2815:26) + + at async file:///app/dist/index.js:12402:22 { + + length: 117, + + severity: 'ERROR', + + code: '42P01', + + detail: undefined, + + hint: undefined, + + position: '97', + + internalPosition: undefined, + + internalQuery: undefined, + + where: undefined, + + schema: undefined, + + table: undefined, + + column: undefined, + + dataType: undefined, + + constraint: undefined, + + file: 'parse_relation.c', + + line: '1392', + + routine: 'parserOpenTable' + +} + +HEAD /api/health 200 in 1ms + +🔍 Test webhook BAP: { + + url: 'https://workflow.ffnancy.fr/webhook-test/a3d03176-b72f-412d-8fb9-f920b9fbab4d' + +} + +🌐 Réponse test webhook: { status: 404, ok: false } + +POST /api/webhook-bap-config/test 500 in 86ms + +❌ Erreur test webhook BAP: Error: HTTP 404: Not Found + + at file:///app/dist/index.js:12481:15 + + at process.processTicksAndRejections (node:internal/process/task_queues:95:5) + +🔍 Test webhook BAP: { + + url: 'https://workflow.ffnancy.fr/webhook-test/a3d03176-b72f-412d-8fb9-f920b9fbab4d' + +} + +🌐 Réponse test webhook: { status: 500, ok: false } + +❌ Erreur test webhook BAP: Error: HTTP 500: Internal Server Error + + at file:///app/dist/index.js:12481:15 + + at process.processTicksAndRejections (node:internal/process/task_queues:95:5) + +POST /api/webhook-bap-config/test 500 in 72ms + +HEAD /api/health 200 in 0ms + +❌ Erreur sauvegarde config webhook BAP: error: relation "webhook_bap_config" does not exist + + 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.getWebhookBapConfig (file:///app/dist/index.js:2815:26) + + at async file:///app/dist/index.js:12431:30 { + + length: 117, + + severity: 'ERROR', + + code: '42P01', + + detail: undefined, + + hint: undefined, + + position: '97', + + internalPosition: undefined, + + internalQuery: undefined, + + where: undefined, + + schema: undefined, + + table: undefined, + + column: undefined, + + dataType: undefined, + + constraint: undefined, + + file: 'parse_relation.c', + + line: '1392', + + routine: 'parserOpenTable' + +} + +POST /api/webhook-bap-config 500 in 6ms \ No newline at end of file diff --git a/scripts/docker-entrypoint.sh b/scripts/docker-entrypoint.sh old mode 100755 new mode 100644 index 6ddde3e..18d9e1c --- a/scripts/docker-entrypoint.sh +++ b/scripts/docker-entrypoint.sh @@ -54,16 +54,47 @@ if [ -f "/app/scripts/auto-migrate-production.sh" ]; then log "📂 Script de migration trouvé, exécution..." chmod +x /app/scripts/auto-migrate-production.sh - if /app/scripts/auto-migrate-production.sh; then + # Forcer l'affichage des logs du script de migration + log "🔄 Démarrage des migrations avec logs détaillés..." + if /app/scripts/auto-migrate-production.sh 2>&1; then log "✅ Migrations exécutées avec succès" else - log "❌ Erreur lors des migrations" - exit 1 + log "❌ Erreur lors des migrations, mais continuation..." + # Ne pas exit pour éviter de bloquer le démarrage fi else log "⚠️ Script de migration non trouvé à /app/scripts/auto-migrate-production.sh" log "🔍 Contenu du répertoire scripts:" ls -la /app/scripts/ || echo "Répertoire scripts non trouvé" + + # Créer la table webhook_bap_config directement si le script manque + log "🛠️ Tentative de création directe de la table webhook_bap_config..." + if [ -n "$DATABASE_URL" ]; then + psql "$DATABASE_URL" << 'EOF' +CREATE TABLE IF NOT EXISTS webhook_bap_config ( + id SERIAL PRIMARY KEY, + name VARCHAR(100) NOT NULL DEFAULT 'Configuration BAP', + webhook_url TEXT NOT NULL, + description TEXT, + is_active BOOLEAN NOT NULL DEFAULT true, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); + +INSERT INTO webhook_bap_config (name, webhook_url, description, is_active) +SELECT + 'Configuration BAP', + 'https://workflow.ffnancy.fr/webhook/a3d03176-b72f-412d-8fb9-f920b9fbab4d', + 'Configuration par défaut pour envoi des fichiers BAP vers n8n', + true +WHERE NOT EXISTS (SELECT 1 FROM webhook_bap_config); + +COMMENT ON TABLE webhook_bap_config IS 'Configuration pour webhook BAP n8n'; +EOF + log "✅ Table webhook_bap_config créée directement" + else + log "❌ DATABASE_URL manquante pour création directe" + fi fi # Vérification post-migration @@ -81,6 +112,39 @@ ADD COLUMN IF NOT EXISTS stock_epuise_by varchar(255), ADD COLUMN IF NOT EXISTS stock_epuise_at timestamp; CREATE INDEX IF NOT EXISTS idx_dlc_products_stock_epuise ON dlc_products(stock_epuise); +EOF + + log "✅ Migration directe DLC terminée" +fi + +# Vérification de la table webhook_bap_config +log "🔍 Vérification de la table webhook_bap_config..." +if psql "$DATABASE_URL" -tAc "SELECT EXISTS (SELECT FROM information_schema.tables WHERE table_schema='public' AND table_name='webhook_bap_config');" | grep -q "t"; then + log "✅ Table webhook_bap_config présente" +else + log "❌ Table webhook_bap_config manquante" + log "🛠️ Création directe de la table webhook_bap_config..." + + psql "$DATABASE_URL" << 'EOF' +CREATE TABLE webhook_bap_config ( + id SERIAL PRIMARY KEY, + name VARCHAR(100) NOT NULL DEFAULT 'Configuration BAP', + webhook_url TEXT NOT NULL, + description TEXT, + is_active BOOLEAN NOT NULL DEFAULT true, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); + +INSERT INTO webhook_bap_config (name, webhook_url, description, is_active) +VALUES ( + 'Configuration BAP', + 'https://workflow.ffnancy.fr/webhook/a3d03176-b72f-412d-8fb9-f920b9fbab4d', + 'Configuration par défaut pour envoi des fichiers BAP vers n8n', + true +); + +COMMENT ON TABLE webhook_bap_config IS 'Configuration pour webhook BAP n8n'; EOF if [ $? -eq 0 ]; then