Improve photo handling by ensuring images are correctly saved in the database

Removes debug logs and ensures correct mapping of photo data from request body to database columns.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: dec54137-d5a2-4406-8ad4-5f2f9fb110bf
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/0715008c-7244-40f4-befc-26c014852236/e6f3a8c1-bdaf-4251-a9d4-9326e97ede4b.jpg
This commit is contained in:
michaelschal committed 2025-07-11 18:49:16 +00:00
1 parent c532a2c946
commit 08e3258a32
1 file changed
+1 -9
+1 -9
View File
@@ -243,12 +243,7 @@ export async function registerRoutes(app: Express): Promise<Server> {
targetStoreId = user.storeId;
}
// Debug logging
console.log('=== PHOTO MAPPING DEBUG ===');
console.log('photoRecto present:', !!req.body.photoRecto);
console.log('photoVerso present:', !!req.body.photoVerso);
console.log('photoTicket present:', !!req.body.photoTicket);
console.log('photoTicket length:', req.body.photoTicket?.length);
// Photo mapping debug (can be removed in production)
// Map frontend camelCase to database snake_case for photos
const mappedBody = {
@@ -258,15 +253,12 @@ export async function registerRoutes(app: Express): Promise<Server> {
// Add photo fields with proper mapping, only if they exist and are not empty
if (req.body.photoRecto) {
mappedBody.photo_recto = req.body.photoRecto;
console.log('Added photo_recto to mappedBody');
}
if (req.body.photoVerso) {
mappedBody.photo_verso = req.body.photoVerso;
console.log('Added photo_verso to mappedBody');
}
if (req.body.photoTicket) {
mappedBody.photo_ticket = req.body.photoTicket;
console.log('Added photo_ticket to mappedBody');
}
// Remove camelCase versions to avoid conflicts