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