WP-04 API spec
The module is in afia-api. Contract types: Account, Role, Clinic in contracts.md. Wire: exchange/admin.md.
Usage
Admin HTTP lists accounts and assigns roles that already exist on Account. Clinic configuration is one resource with name and timezone. Paths stay under /api/v1/afia/admin.
Domain
Clinicathealth.afia.app.admin.Clinic. ContractClinic.- Reuse
AccountandRolefrom identity. Do not redefine them.
Persistence
ClinicEntity table clinic. One row is enough until WP-10. Directory reads Account through identity. No second user table.
HTTP DTOs
AdminUserResponseDtooutbound. Account fields the directory shows.AssignRoleDtoinbound.accountId,role.ClinicRequestDtoinbound.name,timezone.ClinicResponseDtooutbound. Same fields as contractClinic.
Mappers
ClinicMapper.toResponse(Clinic) -> ClinicResponseDto
ClinicMapper.toDomain(ClinicEntity) -> Clinic
Account listing maps with identity's AccountMapper or a package-local view that does not persist a copy.
Services
AdminDirectoryService
listAccounts() -> Account[]
assignRole(accountId, role) -> Account
getClinic() -> Clinic
updateClinic(name, timezone) -> Clinic
Controllers
AdminControlleron reserved/api/v1/afia/admin. Users, role assignment, and clinic on that prefix.
Does not do
Identity persistence. afia-web pages. Patient, clinician, or diagnostics packages. Flutter types. Invented admin screens.