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
+31
View File
@@ -0,0 +1,31 @@
const fs = require('fs');
const path = require('path');
const LOGS_FILE = path.join(__dirname, '..', 'logs', 'connexions.json');
const MAX_LOGS = 500;
function readLogs() {
try {
return JSON.parse(fs.readFileSync(LOGS_FILE, 'utf8'));
} catch (_) {
return [];
}
}
function writeLogs(logs) {
fs.mkdirSync(path.dirname(LOGS_FILE), { recursive: true });
fs.writeFileSync(LOGS_FILE, JSON.stringify(logs, null, 2), 'utf8');
}
function logLogin({ username, role = null, ip = null, success }) {
const logs = readLogs();
logs.unshift({ timestamp: new Date().toISOString(), username, role, ip, success: !!success });
if (logs.length > MAX_LOGS) logs.length = MAX_LOGS;
writeLogs(logs);
}
function getLogs(limit = 100) {
return readLogs().slice(0, limit);
}
module.exports = { logLogin, getLogs };