mirror of
https://github.com/R0m1k3/CollectFlow.git
synced 2026-10-18 12:46:32 +02:00
fix: remove deprecated eslint config and make dashboard DB enrichment optional
- Remove unsupported `eslint` key from next.config.ts (Next.js 16) - Wrap dashboard DB enrichment in try/catch so the dashboard renders even when PostgreSQL is unavailable, preventing the "Impossible de charger le tableau de bord" error Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
1 parent
42e39a1c2b
commit
64da878abb
2 files changed
+23
-20
No files matched your search
@@ -10,9 +10,6 @@ const nextConfig = {
|
|||||||
typescript: {
|
typescript: {
|
||||||
ignoreBuildErrors: true,
|
ignoreBuildErrors: true,
|
||||||
},
|
},
|
||||||
eslint: {
|
|
||||||
ignoreDuringBuilds: true,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default nextConfig;
|
export default nextConfig;
|
||||||
+23
-17
@@ -601,23 +601,29 @@ export async function pgGetDashboardData(): Promise<DashboardData> {
|
|||||||
];
|
];
|
||||||
const allCodeins = [...new Set(allItems.map(i => i.codein).filter(Boolean))];
|
const allCodeins = [...new Set(allItems.map(i => i.codein).filter(Boolean))];
|
||||||
|
|
||||||
// Enrichissement : stock et fournisseur via PostgreSQL
|
// Enrichissement : stock et fournisseur via PostgreSQL (optionnel — le dashboard
|
||||||
const [stockMap, fouResult] = await Promise.all([
|
// s'affiche même si la DB n'est pas configurée).
|
||||||
pgGetStockForCodeins(allCodeins),
|
let stockMap = new Map<string, { stock292: number; stock579: number; stockTotal: number }>();
|
||||||
pgNoParallel(sql`
|
let fouMap = new Map<string, string>();
|
||||||
SELECT
|
try {
|
||||||
a.codein,
|
const [sm, fouResult] = await Promise.all([
|
||||||
COALESCE(fi.nom, af.code, 'Sans fournisseur')::text AS fournisseur
|
pgGetStockForCodeins(allCodeins),
|
||||||
FROM articles a
|
pgNoParallel(sql`
|
||||||
LEFT JOIN artfou1 af ON af.art_no_id = a.no_id AND af.preference = 1
|
SELECT
|
||||||
LEFT JOIN fouident fi ON fi.code = af.code
|
a.codein,
|
||||||
WHERE a.codein = ANY(string_to_array(${allCodeins.join(",")}, ','))
|
COALESCE(fi.nom, af.code, 'Sans fournisseur')::text AS fournisseur
|
||||||
`),
|
FROM articles a
|
||||||
]);
|
LEFT JOIN artfou1 af ON af.art_no_id = a.no_id AND af.preference = 1
|
||||||
|
LEFT JOIN fouident fi ON fi.code = af.code
|
||||||
const fouMap = new Map<string, string>();
|
WHERE a.codein = ANY(string_to_array(${allCodeins.join(",")}, ','))
|
||||||
for (const row of fouResult.rows as unknown as { codein: string; fournisseur: string }[]) {
|
`),
|
||||||
if (row.codein) fouMap.set(row.codein, row.fournisseur);
|
]);
|
||||||
|
stockMap = sm;
|
||||||
|
for (const row of fouResult.rows as unknown as { codein: string; fournisseur: string }[]) {
|
||||||
|
if (row.codein) fouMap.set(row.codein, row.fournisseur);
|
||||||
|
}
|
||||||
|
} catch (enrichErr) {
|
||||||
|
console.warn("[Dashboard] DB enrichment unavailable, continuing with API data only:", enrichErr);
|
||||||
}
|
}
|
||||||
|
|
||||||
const siteSet = [...new Set(allItems.map(i => i.site).filter(Boolean))].sort();
|
const siteSet = [...new Set(allItems.map(i => i.site).filter(Boolean))].sort();
|
||||||
|
|||||||
Reference in new issue
Block a user