Fix issues with creating new entries and improve data validation

Update server route error handling and Zod schemas for optional fields to resolve creation errors.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 9fcf4b21-eb0c-4e53-a567-e2ce4a6ad869
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/9fcf4b21-eb0c-4e53-a567-e2ce4a6ad869/p0qYuko
This commit is contained in:
michaelschal committed 2025-09-08 15:20:14 +00:00
1 parent 070daf71ac
commit b3eb0644e0
3 files changed
+208 -3

No files matched your search

+2 -1
View File
@@ -2471,9 +2471,10 @@ export async function registerRoutes(app: Express): Promise<Server> {
res.json(avoir);
} catch (error) {
if (error instanceof z.ZodError) {
console.error('❌ [POST AVOIR] ERREURS VALIDATION ZOD:', JSON.stringify(error.errors, null, 2));
return res.status(400).json({ message: "Validation error", errors: error.errors });
}
console.error("Error creating avoir:", error);
console.error("❌ [POST AVOIR] Erreur générale:", error);
res.status(500).json({ message: "Failed to create avoir" });
}
});