Merge pull request #128 from R0m1k3/1.1

1.1
This commit is contained in:
LogiFlow authored and GitHub committed 2025-08-14 13:53:41 +02:00
commit 35bb86adf1
4 files changed
+252 -14

No files matched your search

@@ -0,0 +1,201 @@
dbHost: 'logiflow-db'
}
🐳 PRODUCTION: Using standard PostgreSQL
✅ PostgreSQL connection test successful
🔗 Database initialization: {
NODE_ENV: 'production',
isProduction: true,
hasDbUrl: true,
dbHost: 'logiflow-db:5432'
}
✅ Using DatabaseStorage (production PostgreSQL)
⏰ Automatic backup scheduled for 2:00 AM daily (native timer)
🔍 Using development storage and authentication
🐳 PRODUCTION: Starting LogiFlow application
🐳 Environment: { NODE_ENV: 'production', DATABASE_URL: 'Present', PORT: '3000' }
🔧 Registering all production routes...
🔄 Running automatic production migrations...
🔄 MIGRATION: Starting SAV production migrations...
🔄 MIGRATION: Database URL configured: postgresql://logiflow_admin:Lo...
✅ MIGRATION: Connected to PostgreSQL database
🔄 MIGRATION: Checking if priority column exists...
🔄 MIGRATION: Priority column check result: 1
✅ MIGRATION: Priority column already exists, skipping migration
🔌 MIGRATION: Database connection closed
🔧 Using memory session store for development
Warning: connect.session() MemoryStore is not
designed for a production environment, as it will leak
memory, and will not scale past a single process.
✅ All routes registered successfully for production
🐳 Serving static files from: /app/dist/public
🐳 PRODUCTION: LogiFlow serving on port 3000
HEAD /api/health 200 in 4ms
📄 SPA: Serving index.html for /customer-orders
GET /api/user 401 in 1ms
📄 SPA: Serving index.html for /auth
GET /api/user 401 in 3ms
GET /api/user 401 in 1ms
GET /api/default-credentials-check 304 in 2ms
🔐 comparePasswords: {
supplied: 'HIDDEN',
stored: 'b23ec450a63faf3957a1...',
hasFormat: true
}
🔐 Password comparison result: true
POST /api/login 200 in 62ms
GET /api/user 304 in 5ms
GET /api/user 304 in 12ms
Deliveries API called with: {
startDate: undefined,
endDate: undefined,
storeId: undefined,
withBL: undefined,
userRole: 'employee'
}
Non-admin filtering deliveries with groupIds: [ 2 ]
📊 Calcul statistiques mensuelles: {
year: 2025,
month: 8,
startDate: '2025-08-01',
endDate: '2025-09-01',
groupIds: [ 2 ]
}
GET /api/publicities 304 in 179ms
Tasks API called with: { groupIds: [ 2 ], userRole: 'employee' }
Customer Orders API called with: { groupIds: [ 2 ], userRole: 'employee' }
Orders API called with: {
startDate: undefined,
endDate: undefined,
storeId: undefined,
userRole: 'employee'
}
Non-admin filtering with groupIds: [ 2 ]
GET /api/user 304 in 126ms
📊 Statistiques calculées: {
ordersCount: 8,
deliveriesCount: 21,
pendingOrdersCount: 4,
averageDeliveryTime: 0.17647058823529413,
totalPalettes: 57,
totalPackages: 17
}
Tasks returned: 9 items
GET /api/stats/monthly 304 in 227ms
GET /api/dlc-products/stats 304 in 206ms
GET /api/tasks 304 in 203ms
Customer Orders returned: 25 items
GET /api/customer-orders 304 in 235ms
🔗 PRODUCTION: getDeliveries() récupéré 38 livraisons avec relations
Deliveries returned: 38 items
GET /api/deliveries 304 in 281ms
🔗 PRODUCTION: getOrders() récupéré 18 commandes avec relations
Orders returned: 18 items
GET /api/orders 304 in 300ms
GET /api/user 304 in 8ms
GET /api/publicities 304 in 25ms
GET /api/groups 304 in 4ms
GET /api/user 304 in 4ms
GET /api/suppliers 304 in 7ms
GET /api/user 304 in 3ms
HEAD /api/health 200 in 1ms
Binary file not shown.

After

Width:  |  Height:  |  Size: 249 KiB

+27 -3
View File
@@ -68,6 +68,16 @@ export function CustomerOrderForm({
const { user } = useAuthUnified();
const { selectedStoreId } = useStore();
// DEBUG: Log user data to see what we actually receive
console.log("🔍 FRONTEND USER DEBUG:", {
user: user,
userRole: user?.role,
userGroups: user?.userGroups,
userGroupsType: typeof user?.userGroups,
userGroupsLength: user?.userGroups?.length,
fullUserObject: JSON.stringify(user, null, 2)
});
// Fetch groups for store selection
const { data: groups = [] } = useQuery<Group[]>({
queryKey: ['/api/groups'],
@@ -122,10 +132,17 @@ export function CustomerOrderForm({
console.log("📝 Form submission data:", data);
console.log("🔍 Form errors:", form.formState.errors);
console.log("✅ Form is valid:", form.formState.isValid);
console.log("👤 User context:", {
console.log("👤 User context DETAILED:", {
role: user?.role,
userGroups: user?.userGroups,
selectedStoreId
userGroupsLength: user?.userGroups?.length,
userGroupsData: user?.userGroups?.map(ug => ({
groupId: ug.groupId,
group: ug.group,
fullObject: ug
})),
selectedStoreId,
fullUser: user
});
// Validate required fields
@@ -138,7 +155,14 @@ export function CustomerOrderForm({
const groupId = getUserAssignedGroupId();
if (!groupId) {
console.error("❌ No group available for user:", user?.role, user?.userGroups);
console.error("❌❌❌ CRITICAL: No group available for user:", {
role: user?.role,
userGroups: user?.userGroups,
userGroupsCount: user?.userGroups?.length,
selectedStoreId,
getUserAssignedGroupIdResult: groupId
});
alert("ERREUR: Votre utilisateur n'a pas de magasin assigné. Contactez l'administrateur.");
return;
}
+24 -11
View File
@@ -188,20 +188,33 @@ export function setupLocalAuth(app: Express) {
app.get("/api/logout", logoutHandler);
// Get current user
app.get("/api/user", (req, res) => {
app.get("/api/user", async (req, res) => {
if (!req.isAuthenticated()) {
return res.status(401).json({ message: "Non authentifié" });
}
const user = req.user as SelectUser;
res.json({
id: user.id,
username: user.username,
email: user.email,
firstName: user.firstName,
lastName: user.lastName,
role: user.role,
passwordChanged: user.passwordChanged
});
try {
const userId = (req.user as SelectUser).id;
const userWithGroups = await storage.getUserWithGroups(userId);
if (!userWithGroups) {
return res.status(404).json({ message: "Utilisateur non trouvé" });
}
res.json({
id: userWithGroups.id,
username: userWithGroups.username,
email: userWithGroups.email,
firstName: userWithGroups.firstName,
lastName: userWithGroups.lastName,
role: userWithGroups.role,
passwordChanged: userWithGroups.passwordChanged,
userGroups: userWithGroups.userGroups || []
});
} catch (error) {
console.error("Error fetching user with groups:", error);
res.status(500).json({ message: "Erreur lors de la récupération des données utilisateur" });
}
});
// Check if default credentials should be shown