All files / src/presentation/http/routes specialty.routes.ts

100% Statements 2/2
100% Branches 0/0
100% Functions 2/2
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24          22x                           1x        
import type { App } from '../../../infrastructure/http/build-app';
import { MEDICAL_SPECIALTIES } from '../../../domain/appointment/medical-specialty';
import { medicalSpecialtyListResponseSchema } from '../schemas/specialty.schema';
 
export async function specialtyRoutes(app: App) {
  app.route({
    method: 'GET',
    url: '/specialties',
    schema: {
      tags: ['Appointments'],
      summary: 'List medical specialties',
      description:
        'Returns the static reference list of medical specialties used to power autocomplete suggestions on ' +
        'the appointment form. Public — not tied to any user or baby.',
      response: {
        200: medicalSpecialtyListResponseSchema,
      },
    },
    handler: async (_request, reply) => {
      return reply.status(200).send([...MEDICAL_SPECIALTIES]);
    },
  });
}