إنتقل إلى المحتوى الرئيسي

WP-02 API spec

The module is in afia-api. Contract type: PatientProfile in contracts.md. Wire: exchange/patient-profile.md.

Usage​

A patient reads and updates their own profile on /api/v1/afia/patient/profile. The handler takes accountId from the session once WP-01 exists. Until then, accept accountId on the resource.

Domain​

  • PatientProfile at health.afia.app.patient.profile.PatientProfile. Contract PatientProfile.

Persistence​

PatientProfileEntity table patient_profile. Columns match the contract fields only. Do not store appointments or results here.

HTTP DTOs​

  • PatientProfileRequestDto inbound. Field displayName.
  • PatientProfileResponseDto outbound. Fields accountId, displayName.

Mappers​

PatientProfileMapper.toResponse(PatientProfile) -> PatientProfileResponseDto
PatientProfileMapper.toDomain(PatientProfileEntity) -> PatientProfile
PatientProfileMapper.apply(PatientProfile, PatientProfileRequestDto) -> PatientProfile

Services​

PatientProfileService
get(accountId) -> PatientProfile
update(accountId, displayName) -> PatientProfile

Controllers​

  • PatientProfileController on reserved /api/v1/afia/patient/profile. GET and write for the current patient.

Does not do​

health.afia.app.patient.appointment or health.afia.app.patient.results. Identity Account persistence. Flutter types. Consult or booking widgets.