feat: RLA API v1.0.0 — API complète + exports + thème McKinsey

- 9 endpoints métier : synthese, alertes, en-service, en-cours,
  par-region, clotures, pilotage-proactif, matrice-risque
- Exports PDF (tous rôles) / XLSX PPTX DOCX (superadmin)
- services/calc.js : helpers normalisés partagés
- services/export-pdf.js : PDF async PDFKit par vue
- Thème McKinsey (#1C2B4B / bleu pétrole / gris sobre)
- Boutons XLSX/DOCX front (superadmin uniquement)
- BASEROW_API_URL → https://baserow.bolbol.tn/api/
- dotenv override: true

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Nabil Derouiche
2026-03-12 23:47:10 +01:00
co-authored by Claude Sonnet 4.6
commit 88a0dbe6d2
39 changed files with 7622 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
const axios = require('axios');
const BASE_URL = process.env.BASEROW_API_URL;
const TOKEN = process.env.BASEROW_TOKEN;
const TABLE_MARCHES = process.env.BASEROW_TABLE_MARCHES;
const TABLE_PIPELINE = process.env.BASEROW_TABLE_PIPELINE;
const client = axios.create({
baseURL: BASE_URL,
headers: { Authorization: `Token ${TOKEN}` },
});
// Récupère toutes les lignes d'une table (gestion pagination)
async function fetchAllRows(tableId, filters = {}) {
const rows = [];
let page = 1;
let hasMore = true;
while (hasMore) {
const { data } = await client.get(`/database/rows/table/${tableId}/`, {
params: { page, size: 200, user_field_names: true, ...filters },
});
rows.push(...data.results);
hasMore = data.next !== null;
page++;
}
return rows;
}
// Récupère une seule ligne par ID
async function fetchRow(tableId, rowId) {
const { data } = await client.get(
`/database/rows/table/${tableId}/${rowId}/`,
{ params: { user_field_names: true } }
);
return data;
}
module.exports = {
getMarches: (filters) => fetchAllRows(TABLE_MARCHES, filters),
getMarcheById: (id) => fetchRow(TABLE_MARCHES, id),
getPipeline: (filters) => fetchAllRows(TABLE_PIPELINE, filters),
};