import { Router, json as jsonMiddleware } from "express";
import { getTests, getPipelineMappings } from "../database/queries/catalog.js";
const router = Router();

const maxSize = 1024 * 1024 * 100; // 100MB

// Apply Middlewares
router.use(jsonMiddleware({ limit: maxSize }));

// Get Routes
router.get("/tests", (req, res) => {
  getTests().then((t) => res.json(t));
});

router.get("/pipeline-mappings", (req, res) => {
  getPipelineMappings().then((m) => res.json(m));
});

// Post Routes
router.post("/update", (req, res) => {
  // Update All Tests
  res.sendStatus(200);
});

export default router;
