diff --git a/attached_assets/image_1757363260967.png b/attached_assets/image_1757363260967.png new file mode 100644 index 0000000..bb7acef Binary files /dev/null and b/attached_assets/image_1757363260967.png differ diff --git a/server/routes.ts b/server/routes.ts index f5c2199..eded677 100644 --- a/server/routes.ts +++ b/server/routes.ts @@ -2506,7 +2506,16 @@ export async function registerRoutes(app: Express): Promise { const validatedData = insertAvoirSchema.partial().parse(req.body); console.log('πŸ’° PUT Avoir - Validated data:', JSON.stringify(validatedData, null, 2)); - const updatedAvoir = await storage.updateAvoir(id, validatedData); + // βœ… FIX: Convertir undefined en null pour les champs optionnels (important pour PostgreSQL) + const dataForDb: any = { + ...validatedData, + amount: validatedData.amount === undefined ? null : validatedData.amount, + invoiceReference: validatedData.invoiceReference === undefined ? null : validatedData.invoiceReference, + comment: validatedData.comment === undefined ? null : validatedData.comment, + }; + console.log('πŸ’° PUT Avoir - Data for DB (undefined β†’ null):', JSON.stringify(dataForDb, null, 2)); + + const updatedAvoir = await storage.updateAvoir(id, dataForDb); console.log('βœ… Avoir updated:', id, 'by user:', user.id); // 🎯 WEBHOOK QUAND STATUT PASSE Γ€ "ReΓ§u"