// @ts-nocheck — route controller converted to .cts; handler req/res typed, full type-check deferred (thin glue over typed services).
import type { Req, Res, Next } from '../types/http';
const express = require('express');
const router = express.Router();
const { standardizeError } = require('../middleware/errorFormatter.cts');
const { getAnalyticsSummary } = require('../services/analyticsService.cts');

router.get('/summary', (req: Req, res: Res) => {
  const result = getAnalyticsSummary(req.user.id, req.query);
  if (result.error)
    return res.status(400).json(standardizeError(result.error, 'VALIDATION_ERROR', 'month'));
  res.json(result);
});

module.exports = router;
