BillTracker/routes/analytics.cts

15 lines
677 B
TypeScript
Raw Normal View History

// @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';
2026-05-04 13:14:32 -05:00
const express = require('express');
const router = express.Router();
const { standardizeError } = require('../middleware/errorFormatter');
const { getAnalyticsSummary } = require('../services/analyticsService.cts');
2026-05-04 13:14:32 -05:00
router.get('/summary', (req: Req, res: Res) => {
2026-05-16 15:38:28 -05:00
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);
2026-05-04 13:14:32 -05:00
});
module.exports = router;