mirror of
https://github.com/R0m1k3/Regisflow.git
synced 2026-10-11 17:29:48 +02:00
Ensure receipt photos are properly saved when creating new sales records
Fix: Map camelCase photo names to snake_case in routes.ts for correct database storage. 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/183bde94-866e-4679-97fd-7df41a964b4d.jpg
This commit is contained in:
1 parent
25d275dfea
commit
c532a2c946
2 files changed
+35
-1
No files matched your search
@@ -285,6 +285,9 @@ Preferred communication style: Simple, everyday language.
|
||||
- ✅ Photo capture system fully integrated with database storage
|
||||
- ✅ Modal de détails des ventes opérationnel avec support complet des photos
|
||||
- ✅ API et schéma de base de données synchronisés pour la production
|
||||
- ✅ Bug critique corrigé : mapping camelCase/snake_case pour photo_ticket
|
||||
- ✅ NewSaleForm.tsx corrigé pour inclure photoTicket dans la soumission
|
||||
- ✅ API routes.ts corrigé avec mapping automatique des photos
|
||||
- ✅ RegisFlow prêt pour déploiement en production avec toutes les fonctionnalités
|
||||
|
||||
### Docker Configuration & Cleanup (January 9, 2025)
|
||||
|
||||
+32
-1
@@ -243,8 +243,39 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
||||
targetStoreId = user.storeId;
|
||||
}
|
||||
|
||||
const saleData = insertSaleSchema.parse({
|
||||
// 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);
|
||||
|
||||
// Map frontend camelCase to database snake_case for photos
|
||||
const mappedBody = {
|
||||
...req.body,
|
||||
};
|
||||
|
||||
// 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
|
||||
delete mappedBody.photoRecto;
|
||||
delete mappedBody.photoVerso;
|
||||
delete mappedBody.photoTicket;
|
||||
|
||||
const saleData = insertSaleSchema.parse({
|
||||
...mappedBody,
|
||||
storeId: targetStoreId,
|
||||
userId: user.id
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user