const express = require('express');
const router = express.Router();
const { getPipeline } = require('../services/baserow');

// GET /api/pipeline
router.get('/', async (req, res) => {
  try {
    const rows = await getPipeline();
    res.json({ count: rows.length, results: rows });
  } catch (err) {
    res.status(502).json({ error: 'Erreur Baserow', detail: err.message });
  }
});

module.exports = router;
