diff --git a/VEZA_INTEGRATION_PERFECTION_TODOLIST_TEMPLATE.json b/VEZA_INTEGRATION_PERFECTION_TODOLIST_TEMPLATE.json index 289f8c12f..2b262e634 100644 --- a/VEZA_INTEGRATION_PERFECTION_TODOLIST_TEMPLATE.json +++ b/VEZA_INTEGRATION_PERFECTION_TODOLIST_TEMPLATE.json @@ -355,7 +355,8 @@ "description": "L'interface ApiError frontend est incomplète par rapport aux erreurs retournées par le backend.", "priority": "P1", "priority_rank": 9, - "status": "todo", + "status": "completed", + "completed_at": "2025-01-27T13:45:00Z", "estimated_hours": 1.5, "side": "frontend_only", "files_to_modify": [ @@ -1090,13 +1091,13 @@ }, "progress_tracking": { "total_tasks": 32, - "completed": 8, + "completed": 9, "in_progress": 0, - "todo": 24, + "todo": 23, "blocked": 0, - "completion_percentage": 25, - "last_updated": "2025-01-27T13:30:00Z", + "completion_percentage": 28, + "last_updated": "2025-01-27T13:45:00Z", "estimated_completion_date": null, - "estimated_hours_remaining": 36 + "estimated_hours_remaining": 34.5 } } diff --git a/apps/web/src/schemas/apiSchemas.ts b/apps/web/src/schemas/apiSchemas.ts index d0f0b7cc1..857ea7877 100644 --- a/apps/web/src/schemas/apiSchemas.ts +++ b/apps/web/src/schemas/apiSchemas.ts @@ -182,18 +182,22 @@ export type AuditLog = z.infer; /** * ApiError schema + * INT-TYPE-006: Aligned with backend error format (handlers/error_response.go) + * Backend ErrorDetail: { field, message } */ export const apiErrorSchema = z.object({ - code: z.number().int(), + code: z.number().int(), // ErrorCode (1000-9999) or HTTP status code message: z.string(), + // INT-TYPE-006: details matches backend ErrorDetail[] structure details: z.array(z.object({ - field: z.string(), - message: z.string(), + field: z.string(), // Field name from ErrorDetail.Field + message: z.string(), // Error message from ErrorDetail.Message + value: z.string().optional(), // Optional value that failed validation })).optional(), - request_id: z.string().optional(), - timestamp: isoDateSchema, - context: z.record(z.any()).optional(), - retry_after: z.number().int().positive().optional(), + request_id: z.string().optional(), // Request ID for tracking + timestamp: isoDateSchema, // ISO8601 timestamp + context: z.record(z.any()).optional(), // Additional context (user_id, etc.) + retry_after: z.number().int().positive().optional(), // Seconds before retry (for 429) }); export type ApiError = z.infer; diff --git a/apps/web/src/types/api.ts b/apps/web/src/types/api.ts index a9f6666e0..e5994c546 100644 --- a/apps/web/src/types/api.ts +++ b/apps/web/src/types/api.ts @@ -251,18 +251,20 @@ export interface ApiResponse { } // Types pour les erreurs API -// Aligné avec FRONTEND_INTEGRATION.md +// INT-TYPE-006: ApiError interface aligned with backend error format (handlers/error_response.go) +// Backend format: { error: { code, message, details, request_id, timestamp, context } } export interface ApiError { code: number; // Code numérique (1000, 2000, etc.) ou code HTTP (429, 503, 502) message: string; + // INT-TYPE-006: details array matches backend ErrorDetail[] structure details?: Array<{ - field: string; - message: string; - value?: string; // FE-TYPE-005: Added to match backend ValidationError DTO + field: string; // Field name (from ErrorDetail.Field) + message: string; // Error message (from ErrorDetail.Message) + value?: string; // Optional value that failed validation }>; - request_id?: string; - timestamp: string; - context?: Record; + request_id?: string; // Request ID for tracking (from X-Request-ID header) + timestamp: string; // ISO8601 timestamp + context?: Record; // Additional context (user_id, etc.) retry_after?: number; // Nombre de secondes avant de pouvoir réessayer (pour 429) } diff --git a/apps/web/src/types/index.ts b/apps/web/src/types/index.ts index bcb2bd16e..759ed2954 100644 --- a/apps/web/src/types/index.ts +++ b/apps/web/src/types/index.ts @@ -97,10 +97,20 @@ export interface LibraryItem { is_favorite: boolean; } +// INT-TYPE-006: ApiError interface aligned with backend error format +// Backend format: { error: { code, message, details, request_id, timestamp, context } } export interface ApiError { + code: number; // Code numérique (1000, 2000, etc.) ou code HTTP (429, 503, 502) message: string; - code?: string; - details?: Record; + details?: Array<{ + field: string; + message: string; + value?: string; // Optional value that failed validation + }>; + request_id?: string; + timestamp: string; + context?: Record; // Additional context (user_id, etc.) + retry_after?: number; // Nombre de secondes avant de pouvoir réessayer (pour 429) } export interface PaginatedResponse {