aboutsummaryrefslogtreecommitdiff
path: root/api/src/modules/stats/stats.routes.ts
blob: cf02c0810ddd89114dec7cf1c65f379f2a330538 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/**
 * stats.routes.ts
 *
 * GET /api/v1/stats → retorna agregados para o dashboard
 */

import type { FastifyInstance } from 'fastify';
import { statsResponseSchema } from './stats.schema.js';
import { getStatsHandler } from './stats.controller.js';

async function statsRoutes(fastify: FastifyInstance): Promise<void> {
  fastify.get('/', {
    schema: {
      tags:    ['Dashboard'],
      summary: 'Retorna métricas e agregados dos chamados',
    },
    preHandler: [fastify.authenticate],
    handler: getStatsHandler,
  });
}

export default statsRoutes;