mirror of
https://github.com/R0m1k3/CollectFlow.git
synced 2026-10-22 06:28:09 +02:00
feat: add PostgreSQL client for bulk data retrieval and configure Claude permissions
This commit is contained in:
1 parent
638c4b5f3b
commit
910b0c96ef
2 files changed
+15
-13
No files matched your search
@@ -31,7 +31,8 @@
|
|||||||
"Read(//c/Users/Michael/VSCODE/CollectFlow/**)",
|
"Read(//c/Users/Michael/VSCODE/CollectFlow/**)",
|
||||||
"Bash(xargs wc:*)",
|
"Bash(xargs wc:*)",
|
||||||
"Bash(ls /c/Users/Michael/VSCODE/CollectFlow/.next/static/chunks/*.css)",
|
"Bash(ls /c/Users/Michael/VSCODE/CollectFlow/.next/static/chunks/*.css)",
|
||||||
"Bash(find /c/Users/Michael/VSCODE/CollectFlow/src/app/api -type f \\\\\\( -name \"*.ts\" -o -name \"*.tsx\" \\\\\\) -exec ls -lh {} \\\\;)"
|
"Bash(find /c/Users/Michael/VSCODE/CollectFlow/src/app/api -type f \\\\\\( -name \"*.ts\" -o -name \"*.tsx\" \\\\\\) -exec ls -lh {} \\\\;)",
|
||||||
|
"Bash(curl -s \"https://api.ffnancy.fr/api/commandes-auto\")"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+13
-12
@@ -946,23 +946,24 @@ export async function pgGetCommandesAuto(): Promise<PgCommandeAutoRow[]> {
|
|||||||
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
// L'API peut retourner directement un tableau ou un objet wrappé
|
// L'API peut retourner directement un tableau ou un objet wrappé
|
||||||
|
// L'API retourne { count: N, propositions: [...] }
|
||||||
const rows: unknown[] = Array.isArray(data)
|
const rows: unknown[] = Array.isArray(data)
|
||||||
? data
|
? data
|
||||||
: (data?.data ?? data?.items ?? data?.results ?? []);
|
: (data?.propositions ?? data?.data ?? data?.items ?? data?.results ?? []);
|
||||||
console.log(`[pg-ff] pgGetCommandesAuto: ${rows.length} lignes (API Hostinger)`);
|
console.log(`[pg-ff] pgGetCommandesAuto: ${rows.length} lignes (API Hostinger)`);
|
||||||
// Normalise chaque ligne vers PgCommandeAutoRow
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
return (rows as any[]).map((r): PgCommandeAutoRow => ({
|
return (rows as any[]).map((r): PgCommandeAutoRow => ({
|
||||||
site: String(r.site ?? r.Site ?? ""),
|
site: String(r.site ?? ""),
|
||||||
codefou: String(r.codefou ?? r.CodeFou ?? r.code ?? ""),
|
codefou: String(r.codefou ?? ""),
|
||||||
nomfou: String(r.nomfou ?? r.NomFou ?? r.nom ?? ""),
|
nomfou: String(r.nom_fou ?? r.nomfou ?? ""),
|
||||||
franco: Number(r.franco ?? r.Franco ?? 0),
|
franco: Number(r.franco_ht ?? r.franco ?? 0),
|
||||||
nb_articles: Number(r.nb_articles ?? r.nbArticles ?? r.count ?? 0),
|
nb_articles: Number(r.nb_articles ?? 0),
|
||||||
montant_cde: Number(r.montant_cde ?? r.montantCde ?? r.montant ?? 0),
|
montant_cde: Number(r.montant_propo_ht ?? r.montant_cde ?? 0),
|
||||||
franco_atteint: r.franco_atteint != null
|
franco_atteint: r.franco_atteint === "OUI" ? true
|
||||||
? Boolean(r.franco_atteint)
|
: r.franco_atteint === "NON" ? false
|
||||||
: null,
|
: r.franco_atteint != null ? Boolean(r.franco_atteint)
|
||||||
ecart_franco: Number(r.ecart_franco ?? r.ecartFranco ?? 0),
|
: null,
|
||||||
|
ecart_franco: Number(r.ecart_franco ?? 0),
|
||||||
}));
|
}));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("[pg-ff] pgGetCommandesAuto error:", (e as Error).message?.slice(0, 300));
|
console.error("[pg-ff] pgGetCommandesAuto error:", (e as Error).message?.slice(0, 300));
|
||||||
|
|||||||
Reference in new issue
Block a user