mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
5 files changed
+277
-44
No files matched your search
+202
@@ -0,0 +1,202 @@
|
||||
|
||||
|
||||
🔧 Using memory session store for development
|
||||
|
||||
✅ All routes registered successfully for production
|
||||
|
||||
🐳 Serving static files from: /app/dist/public
|
||||
|
||||
🐳 PRODUCTION: LogiFlow serving on port 3000
|
||||
|
||||
HEAD /api/health 200 in 5ms
|
||||
|
||||
📄 SPA: Serving index.html for /dashboard
|
||||
|
||||
GET /api/user 401 in 1ms
|
||||
|
||||
📄 SPA: Serving index.html for /auth
|
||||
|
||||
GET /api/user 401 in 1ms
|
||||
|
||||
GET /api/user 401 in 2ms
|
||||
|
||||
GET /api/default-credentials-check 304 in 3ms
|
||||
|
||||
🔐 comparePasswords: {
|
||||
|
||||
supplied: 'HIDDEN',
|
||||
|
||||
stored: '1c5b14cae257319aea80...',
|
||||
|
||||
hasFormat: true
|
||||
|
||||
}
|
||||
|
||||
🔐 Password comparison result: true
|
||||
|
||||
POST /api/login 200 in 60ms
|
||||
|
||||
GET /api/user 304 in 8ms
|
||||
|
||||
GET /api/user 304 in 21ms
|
||||
|
||||
Customer Orders API called with: { groupIds: undefined, userRole: 'admin' }
|
||||
|
||||
Customer Orders returned: 36 items
|
||||
|
||||
GET /api/customer-orders 304 in 54ms
|
||||
|
||||
📊 Calcul statistiques mensuelles: {
|
||||
|
||||
year: 2025,
|
||||
|
||||
month: 8,
|
||||
|
||||
startDate: '2025-08-01',
|
||||
|
||||
endDate: '2025-09-01',
|
||||
|
||||
groupIds: undefined
|
||||
|
||||
}
|
||||
|
||||
📊 Statistiques calculées: {
|
||||
|
||||
ordersCount: 18,
|
||||
|
||||
deliveriesCount: 42,
|
||||
|
||||
pendingOrdersCount: 6,
|
||||
|
||||
averageDeliveryTime: 0.3611111111111111,
|
||||
|
||||
totalPalettes: 120,
|
||||
|
||||
totalPackages: 36
|
||||
|
||||
}
|
||||
|
||||
GET /api/stats/monthly 304 in 126ms
|
||||
|
||||
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' }
|
||||
|
||||
🌤️ Fetching previous year weather data from API
|
||||
|
||||
GET /api/user 304 in 161ms
|
||||
|
||||
Tasks returned: 61 items
|
||||
|
||||
Orders API called with: {
|
||||
|
||||
startDate: undefined,
|
||||
|
||||
endDate: undefined,
|
||||
|
||||
storeId: undefined,
|
||||
|
||||
userRole: 'admin'
|
||||
|
||||
}
|
||||
|
||||
Admin filtering with groupIds: undefined
|
||||
|
||||
Fetching all orders
|
||||
|
||||
GET /api/tasks 304 in 247ms
|
||||
|
||||
GET /api/publicities 304 in 260ms
|
||||
|
||||
GET /api/dlc-products/stats 304 in 303ms
|
||||
|
||||
🔗 PRODUCTION: getOrders() récupéré 49 commandes avec relations
|
||||
|
||||
Orders returned: 49 items
|
||||
|
||||
GET /api/orders 304 in 456ms
|
||||
|
||||
Orders API called with: {
|
||||
|
||||
startDate: undefined,
|
||||
|
||||
endDate: undefined,
|
||||
|
||||
storeId: '1',
|
||||
|
||||
userRole: 'admin'
|
||||
|
||||
}
|
||||
|
||||
Admin filtering with groupIds: [ 1 ]
|
||||
|
||||
Fetching all orders
|
||||
|
||||
Deliveries API called with: {
|
||||
|
||||
startDate: undefined,
|
||||
|
||||
endDate: undefined,
|
||||
|
||||
storeId: '1',
|
||||
|
||||
withBL: undefined,
|
||||
|
||||
userRole: 'admin'
|
||||
|
||||
}
|
||||
|
||||
Admin filtering deliveries with groupIds: [ 1 ]
|
||||
|
||||
Fetching all deliveries
|
||||
|
||||
GET /api/user 304 in 176ms
|
||||
|
||||
Customer Orders API called with: { groupIds: [ 1 ], userRole: 'admin' }
|
||||
|
||||
🔗 PRODUCTION: getDeliveries() récupéré 82 livraisons avec relations
|
||||
|
||||
Deliveries returned: 82 items
|
||||
|
||||
GET /api/deliveries 304 in 521ms
|
||||
|
||||
🔗 PRODUCTION: getOrders() récupéré 31 commandes avec relations
|
||||
|
||||
Orders returned: 31 items
|
||||
|
||||
GET /api/orders 304 in 252ms
|
||||
|
||||
🔗 PRODUCTION: getDeliveries() récupéré 44 livraisons avec relations
|
||||
|
||||
Deliveries returned: 44 items
|
||||
|
||||
GET /api/deliveries 304 in 261ms
|
||||
|
||||
Customer Orders returned: 9 items
|
||||
|
||||
GET /api/customer-orders 304 in 257ms
|
||||
|
||||
GET /api/publicities 304 in 255ms
|
||||
|
||||
GET /api/groups 304 in 40ms
|
||||
|
||||
Weather API error for previous year: 401
|
||||
|
||||
GET /api/weather/current 304 in 765ms
|
||||
|
||||
@@ -48,6 +48,12 @@ async function registerProductionRoutes(app: Express): Promise<void> {
|
||||
console.log('🔄 Running automatic production migrations...');
|
||||
await runProductionMigrations();
|
||||
|
||||
// Initialize weather system for production
|
||||
console.log('🌤️ [PRODUCTION] Initializing weather system...');
|
||||
const { initializeWeatherConfig } = await import('./weatherAutoConfig.js');
|
||||
await initializeWeatherConfig();
|
||||
console.log('✅ [PRODUCTION] Weather system initialized');
|
||||
|
||||
// Register ALL API routes (same as development)
|
||||
await registerRoutes(app);
|
||||
console.log('✅ All routes registered successfully for production');
|
||||
|
||||
+5
-5
@@ -2,11 +2,11 @@ import express, { type Request, Response, NextFunction } from "express";
|
||||
import { registerRoutes } from "./routes.js";
|
||||
import { setupVite, serveStatic } from "./vite.js";
|
||||
|
||||
// Initialize simple weather system
|
||||
console.log('🌤️ [STARTUP] Initializing simple weather system...');
|
||||
const { default: simpleWeather } = await import('./simpleWeather.js');
|
||||
await simpleWeather.init();
|
||||
console.log('✅ [STARTUP] Simple weather initialized');
|
||||
// Initialize weather system
|
||||
console.log('🌤️ [STARTUP] Initializing weather system...');
|
||||
const { initializeWeatherConfig } = await import('./weatherAutoConfig.js');
|
||||
await initializeWeatherConfig();
|
||||
console.log('✅ [STARTUP] Weather system initialized');
|
||||
|
||||
const app = express();
|
||||
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
// Simple weather service for development
|
||||
const weatherCache = {
|
||||
today: {
|
||||
date: '2025-08-11',
|
||||
location: 'Nancy, France',
|
||||
tempMax: '30.9',
|
||||
tempMin: '13.9',
|
||||
icon: 'clear-day',
|
||||
conditions: 'Clear',
|
||||
isCurrentYear: true
|
||||
},
|
||||
previousYear: {
|
||||
date: '2024-08-11',
|
||||
location: 'Nancy, France',
|
||||
tempMax: '30.9',
|
||||
tempMin: '15.8',
|
||||
icon: 'clear-day',
|
||||
conditions: 'Clear',
|
||||
isCurrentYear: false
|
||||
},
|
||||
lastFetch: new Date().toISOString()
|
||||
};
|
||||
|
||||
const simpleWeather = {
|
||||
async init() {
|
||||
console.log('🌤️ [UPDATE] Fetching fresh weather data...');
|
||||
console.log('🌤️ [FETCH] Calling: Nancy, France for 2025-08-11');
|
||||
console.log('🌤️ [FETCH] Calling: Nancy, France for 2024-08-11');
|
||||
console.log('✅ [UPDATE] Today data cached');
|
||||
console.log('✅ [UPDATE] Last year data cached');
|
||||
console.log('✅ [UPDATE] Weather cache updated at ' + new Date().toISOString());
|
||||
},
|
||||
|
||||
getData() {
|
||||
return weatherCache;
|
||||
}
|
||||
};
|
||||
|
||||
export default simpleWeather;
|
||||
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* Auto-configuration du système météo pour la production
|
||||
* Configure automatiquement les paramètres météo avec la clé API des variables d'environnement
|
||||
*/
|
||||
|
||||
import { storage } from "./storage.js";
|
||||
import { weatherService } from "./weatherService.js";
|
||||
|
||||
export async function initializeWeatherConfig() {
|
||||
try {
|
||||
console.log('🌤️ [AUTO-CONFIG] Initializing weather configuration...');
|
||||
|
||||
// Vérifier si la configuration météo existe déjà
|
||||
const existingSettings = await storage.getWeatherSettings();
|
||||
|
||||
if (existingSettings && existingSettings.isActive) {
|
||||
console.log('✅ [AUTO-CONFIG] Weather settings already configured and active');
|
||||
return;
|
||||
}
|
||||
|
||||
// Récupérer la clé API depuis les variables d'environnement
|
||||
const apiKey = process.env.VISUAL_CROSSING_API_KEY;
|
||||
|
||||
if (!apiKey) {
|
||||
console.log('⚠️ [AUTO-CONFIG] VISUAL_CROSSING_API_KEY not found in environment variables');
|
||||
return;
|
||||
}
|
||||
|
||||
// Configuration par défaut
|
||||
const defaultConfig = {
|
||||
apiKey: apiKey,
|
||||
location: "Nancy, France",
|
||||
isActive: true
|
||||
};
|
||||
|
||||
console.log('🌤️ [AUTO-CONFIG] Testing API connection...');
|
||||
|
||||
// Tester la connexion API avant de sauvegarder
|
||||
const testResult = await weatherService.testApiConnection(defaultConfig.apiKey, defaultConfig.location);
|
||||
|
||||
if (!testResult.success) {
|
||||
console.error('❌ [AUTO-CONFIG] API test failed:', testResult.message);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('✅ [AUTO-CONFIG] API test successful');
|
||||
|
||||
// Créer ou mettre à jour la configuration
|
||||
if (existingSettings) {
|
||||
// Mettre à jour la configuration existante
|
||||
await storage.updateWeatherSettings(existingSettings.id, defaultConfig);
|
||||
console.log('🔄 [AUTO-CONFIG] Weather settings updated');
|
||||
} else {
|
||||
// Créer une nouvelle configuration
|
||||
await storage.createWeatherSettings(defaultConfig);
|
||||
console.log('🆕 [AUTO-CONFIG] Weather settings created');
|
||||
}
|
||||
|
||||
console.log('✅ [AUTO-CONFIG] Weather system successfully configured');
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ [AUTO-CONFIG] Failed to initialize weather config:', error);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user