WP-05 API spec
The module is in afia-api. Contract type: Appointment in contracts.md. Wire: exchange/booking.md.
Usage
A patient lists and requests appointments on /api/v1/afia/appointments. A clinician reads the same rows on /api/v1/afia/clinician/agenda. /api/v1/afia/clinician/patients lists patients who have an appointment with that clinician.
Domain
Appointmentathealth.afia.app.patient.appointment.Appointment. ContractAppointment.- Agenda code in
health.afia.app.clinician.agendareads that type. It does not own a second appointment type.
Persistence
One AppointmentEntity table appointment. Two HTTP faces. No second table in clinician.
HTTP DTOs
AppointmentRequestDtoinbound.clinicianId,slot.AppointmentResponseDtooutbound. ContractAppointmentfields.AgendaQueryDtoinbound.day.ClinicianPatientResponseDtooutbound.patientIdand display fields projected from the appointment join. Not a copy ofPatientProfilestorage.
Mappers
AppointmentMapper.toResponse(Appointment) -> AppointmentResponseDto
AppointmentMapper.toDomain(AppointmentEntity) -> Appointment
Services
BookingService
listAppointments(session) -> Appointment[]
requestAppointment(session, clinicianId, slot) -> Appointment
AgendaService
clinicianAgenda(session, day) -> Appointment[]
clinicianPatients(session) -> patient ids from Appointment rows
writeEncounterNote in the sketch belongs to WP-06, not this package.
Controllers
AppointmentControlleron reserved/api/v1/afia/appointments.ClinicianAgendaControlleron reserved/api/v1/afia/clinician/agendaand/api/v1/afia/clinician/patients.
Does not do
Profile packages, encounter notes, or diagnostics. A second appointment table. Flutter types. Invented calendar widgets.