aboutsummaryrefslogtreecommitdiff
path: root/api/src/modules/settings/settings.routes.ts
blob: 5ae97da8978a50efe157cbaf0ae767e045609e15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import type { FastifyInstance } from 'fastify';
import { getSettingsHandler, updateSettingsHandler } from './settings.controller.js';
import { SettingsSchema } from './settings.schema.js';

export default async function settingsRoutes(fastify: FastifyInstance) {
  fastify.get(
    '/',
    {
      schema: {
        tags: ['Settings'],
        summary: 'Obtém as configurações globais do sistema',
      },
      preHandler: [fastify.authenticate],
    },
    getSettingsHandler,
  );

  fastify.patch(
    '/',
    {
      schema: {
        tags: ['Settings'],
        summary: 'Atualiza as configurações globais do sistema (apenas admin)',
        body: SettingsSchema,
      },
      preHandler: [fastify.authenticate],
    },
    updateSettingsHandler,
  );
}