feat: implement sidebar navigation and automated order management module with PostgreSQL client integration

This commit is contained in:
Michael committed 2026-04-08 15:53:59 +02:00
1 parent d25ffdb3e7
commit 70c425befb
6 files changed
+351 -1

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
import { NextResponse } from "next/server";
import { pgGetCommandesAuto } from "@/lib/pg-ff-client";
/**
* GET /api/commandes-auto
*
* Retourne la liste des fournisseurs en commande automatique,
* groupés par site (292, 579), avec franco et écart franco.
*
* Réponse :
* [
* {
* site: "292",
* codefou: "FOU123",
* nomfou: "Nom Fournisseur",
* franco: 500,
* nb_articles: 12,
* montant_cde: 620.50,
* franco_atteint: true,
* ecart_franco: -120.50
* },
* ...
* ]
*/
export async function GET() {
try {
const rows = await pgGetCommandesAuto();
return NextResponse.json(rows);
} catch (e) {
console.error("[api/commandes-auto]", e);
return NextResponse.json({ error: "Erreur serveur" }, { status: 500 });
}
}