feat: restore reference, gtin, gamme initiale and nomenclature

api-ff-client.ts:
- FfArticle: add reference (ref_fou_principale) and gtin fields
- getArticlesByFournisseur: map ref_fou_principale → reference, gtin → gtin

get-product-rows.ts:
- ProductRow seeded with reference and gtin from API articles
- Phase 6: read codeGamme, codeGammeInit, code3, libelle3 from ventesProduits
  (read-only, DISTINCT ON codein ordered by updated_at DESC)
- Phase 7 snapshot still overrides DB gammes when a snapshot exists

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
MichaelandClaude Sonnet 4.6 committed 2026-03-18 18:08:21 +01:00
1 parent 58f17152a1
commit 47e617afd3
2 files changed
+40 -12

No files matched your search

+11 -7
View File
@@ -27,7 +27,9 @@ export interface FfArticle {
nomfou?: string;
pcb?: number; // conditionnement
pv_central?: number; // prix de vente central
noid?: number; // SQL Server internal ID
noid?: number; // SQL Server internal ID (pour endpoint /mensuel)
reference?: string; // référence fournisseur (ref_fou_principale)
gtin?: string; // code-barres EAN/GTIN
}
export interface FfMouvement {
@@ -203,13 +205,15 @@ export async function getArticlesByFournisseur(
);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return raw.map((r: any): FfArticle => ({
codein: r.codein ?? r.Codein ?? r.code_article ?? r.codeArticle ?? String(r.id ?? ""),
libelle1: r.libelle1 ?? r.Libelle1 ?? r.libelle ?? r.designation ?? r.nom ?? "",
codefou: r.codefou_principal ?? r.codefou ?? r.Codefou ?? r.code_fournisseur ?? r.codeFournisseur ?? codefou,
nomfou: r.nom_fou_principal ?? r.nomfou ?? r.Nomfou ?? r.nom_fournisseur ?? r.nomFournisseur ?? "",
pcb: r.pcb_principal ?? r.pcb ?? r.Pcb ?? r.conditionnement ?? r.colisage,
pv_central: r.pv_central ?? r.PvCentral ?? r.pv ?? r.prixVente,
codein: r.codein ?? r.Codein ?? r.code_article ?? r.codeArticle ?? String(r.id ?? ""),
libelle1: r.libelle1 ?? r.Libelle1 ?? r.libelle ?? r.designation ?? r.nom ?? "",
codefou: r.codefou_principal ?? r.codefou ?? r.Codefou ?? r.code_fournisseur ?? r.codeFournisseur ?? codefou,
nomfou: r.nom_fou_principal ?? r.nomfou ?? r.Nomfou ?? r.nom_fournisseur ?? r.nomFournisseur ?? "",
pcb: r.pcb_principal ?? r.pcb ?? r.Pcb ?? r.conditionnement ?? r.colisage,
pv_central: r.pv_central ?? r.PvCentral ?? r.pv ?? r.prixVente,
noid: r.no_id ?? r.noid ?? r.NoId,
reference: r.ref_fou_principale ?? r.reference ?? r.ref_fournisseur ?? undefined,
gtin: r.gtin ?? r.Gtin ?? r.ean ?? r.barcode ?? undefined,
})).filter(a => a.codein);
}