Add extensive logging to sales data to troubleshoot missing images

Adds debug logs to getAllSales to track sales, photos, and total counts.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: e80fed01-7137-4997-b9af-dad57132d430
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/0715008c-7244-40f4-befc-26c014852236/e80fed01-7137-4997-b9af-dad57132d430/iRu76HV
This commit is contained in:
michaelschal committed 2025-07-19 11:20:36 +00:00
1 parent ec702af70b
commit 39d409203d
2 files changed
+11 -1

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

+11 -1
View File
@@ -202,6 +202,7 @@ export class DatabaseStorage implements IStorage {
}
async getAllSales(storeId?: number): Promise<any[]> {
console.log('DEBUG: getAllSales called with storeId:', storeId);
// Récupérer les ventes avec leurs produits
const query = db
.select({
@@ -290,7 +291,16 @@ export class DatabaseStorage implements IStorage {
});
const result = Array.from(salesMap.values());
console.log('DEBUG: Sample sale with photos:', result.find(s => s.photoRecto || s.photoVerso || s.photoTicket));
const saleWithPhotos = result.find(s => s.photoRecto || s.photoVerso || s.photoTicket);
console.log('DEBUG: Total sales returned:', result.length);
console.log('DEBUG: Sample sale with photos:', saleWithPhotos);
if (saleWithPhotos) {
console.log('DEBUG: Photos found in sale:', saleWithPhotos.id, {
photoRecto: saleWithPhotos.photoRecto ? 'PRESENT' : 'NULL',
photoVerso: saleWithPhotos.photoVerso ? 'PRESENT' : 'NULL',
photoTicket: saleWithPhotos.photoTicket ? 'PRESENT' : 'NULL'
});
}
return result;
}