Files
Gestion-des-Marches-RLA/routes/marches.js
T
Nabil DerouicheandClaude Sonnet 4.6 88a0dbe6d2 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>
2026-03-12 23:47:10 +01:00

27 lines
740 B
JavaScript

const express = require('express');
const router = express.Router();
const { getMarches, getMarcheById } = require('../services/baserow');
// GET /api/marches
router.get('/', async (req, res) => {
try {
const rows = await getMarches();
res.json({ count: rows.length, results: rows });
} catch (err) {
res.status(502).json({ error: 'Erreur Baserow', detail: err.message });
}
});
// GET /api/marches/:id
router.get('/:id', async (req, res) => {
try {
const row = await getMarcheById(req.params.id);
res.json(row);
} catch (err) {
const status = err.response?.status === 404 ? 404 : 502;
res.status(status).json({ error: 'Marché introuvable', detail: err.message });
}
});
module.exports = router;