Improve invoice verification and error handling for deliveries

Fix JSON parsing errors, create a missing invoice verification service with development simulation, and align PostgreSQL schemas with production types.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 7c468936-2a88-4686-ac0a-84921a45222d
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/7c468936-2a88-4686-ac0a-84921a45222d/DT38biO
This commit is contained in:
michaelschal committed 2025-08-13 12:11:18 +00:00
1 parent 5ac9c97e23
commit e4ad3539c7
7 files changed
+153 -151

No files matched your search

+6 -6
View File
@@ -38,7 +38,7 @@ import {
} from "@shared/schema";
import { hasPermission } from "@shared/permissions";
import { z } from "zod";
import { invoiceVerificationService } from "./invoiceVerification.js";
import { invoiceVerificationService } from "./invoiceVerification";
export async function registerRoutes(app: Express): Promise<Server> {
// Health check endpoint for Docker
@@ -134,16 +134,16 @@ export async function registerRoutes(app: Express): Promise<Server> {
console.log('✅ Group creation successful:', { id: group.id, name: group.name });
res.json(group);
} catch (error) {
} catch (error: any) {
console.error('❌ Failed to create group:', {
error: (error as Error).message,
stack: error.stack,
error: error?.message || 'Unknown error',
stack: error?.stack,
body: req.body,
userId: req.user?.id || req.user?.claims?.sub || 'unknown'
});
// Erreur de validation Zod
if (error.name === 'ZodError') {
if (error?.name === 'ZodError') {
console.error('❌ Validation error details:', error.errors);
return res.status(400).json({
message: "Validation failed",
@@ -166,7 +166,7 @@ export async function registerRoutes(app: Express): Promise<Server> {
const data = insertGroupSchema.partial().parse(req.body);
const group = await storage.updateGroup(id, data);
res.json(group);
} catch (error) {
} catch (error: any) {
console.error("Error updating group:", error);
res.status(500).json({ message: "Failed to update group" });
}