fix: extractList includes API-specific wrapper keys, diag uses real codefou

- extractList now explicitly checks "mouvements", "articles", "fournisseurs",
  "ventes", "stocks", "commandes" wrapper keys before generic array fallback
- Diag endpoint auto-fetches first real codefou from fournisseurs instead
  of hardcoded "AUXENCE" (which was supplier nom, not actual codefou)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
MichaelandClaude Sonnet 4.6 committed 2026-03-18 14:57:49 +01:00
1 parent 9e500b6650
commit c33e22f7eb
2 files changed
+13 -2

No files matched your search

+1 -1
View File
@@ -85,7 +85,7 @@ function extractList(data: unknown): any[] {
if (Array.isArray(data)) return data;
const d = data as Record<string, unknown>;
// Essaie les wrappers courants
for (const key of ["items", "data", "result", "results", "records", "list"]) {
for (const key of ["items", "data", "result", "results", "records", "list", "mouvements", "articles", "fournisseurs", "ventes", "stocks", "commandes"]) {
if (Array.isArray(d[key])) return d[key] as unknown[];
}
// Cherche la première propriété qui est un tableau