The Doctors module exposes four commands and three queries built on MediatR’sDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/0Crazy-0/ClinicFlow/llms.txt
Use this file to discover all available pages before exploring further.
IRequest<T> contract. Each command is validated by a FluentValidation AbstractValidator before reaching the handler; invalid requests throw before any domain logic runs. Queries always return projection DTOs, never domain entities directly.
Commands
CreateDoctorProfile
Type:IRequest<Guid>
Registers a new physician in the system under an existing user account and links the profile to a medical specialty. The handler calls DoctorRegistrationService.Register which enforces uniqueness of LicenseNumber across both active and soft-deleted records before persisting.
Parameters
The identity of the application user account that will own this doctor profile. Must be a non-empty GUID.
The doctor’s given name. Combined with
LastName to form the PersonName value object. Must satisfy PersonName.MinimumLength and PersonName.MaximumLength.The doctor’s family name. Same length constraints as
FirstName.The official medical licence number. Must be between
MedicalLicenseNumber.MinimumLength and MedicalLicenseNumber.MaximumLength characters. Checked for global uniqueness (including soft-deleted profiles).Reference to an existing
MedicalSpecialty record. Must be a non-empty GUID.Free-text professional summary displayed on the doctor’s public profile.
Physical room number. Validated between
ConsultationRoom.MinimumNumber and ConsultationRoom.MaximumNumber.Human-readable label for the consultation room (e.g.
"Room A"). Must not be empty.Floor number of the consultation room. Validated between
ConsultationRoom.MinimumFloor and ConsultationRoom.MaximumFloor.Doctor.Id as a Guid.
UpdateDoctorProfile
Type:IRequest (returns Unit)
Updates the mutable portion of a doctor’s profile — biography and consultation room details. Name, licence number, and specialty are immutable after creation. The handler retrieves the doctor by ID (throws EntityNotFoundException if not found) and calls doctor.UpdateProfile.
Parameters
ID of the doctor profile to update. Must be a non-empty GUID.
Replacement biography text. No length restriction enforced at the application layer.
New room number. Same bounds as
CreateDoctorProfile.New room label. Must not be empty.
New floor number. Same bounds as
CreateDoctorProfile.Unit (void).
SuspendDoctorProfile
Type:IRequest (returns Unit)
Soft-deletes the doctor’s profile via doctor.Suspend(). The domain entity raises a DoctorSuspendedEvent that is handled by two downstream event handlers after the save.
Parameters
ID of the doctor to suspend. Throws
EntityNotFoundException if no active doctor is found. Throws BusinessRuleValidationException if the doctor is already suspended.Unit (void).
Domain event raised: DoctorSuspendedEvent(DoctorId)
ReactivateDoctorProfile
Type:IRequest (returns Unit)
Restores a previously suspended (soft-deleted) doctor. The handler looks up the doctor via doctorRepository.GetByIdAsync, constructs a new ConsultationRoom value object, then calls doctor.Reactivate. Throws BusinessRuleValidationException if the profile is already active.
Parameters
ID of the suspended doctor to reactivate.
Updated biography to set on reactivation.
Replacement room number. Same bounds as
CreateDoctorProfile.Replacement room label. Must not be empty.
Replacement floor number. Same bounds as
CreateDoctorProfile.Unit (void).
Queries
GetDoctorById
Type:IRequest<DoctorDto>
Fetches a single doctor profile by its primary key.
Parameters
The primary key of the doctor to retrieve. Must be a non-empty GUID.
DoctorDto or throws EntityNotFoundException if no matching record exists.
GetDoctorByUserId
Type:IRequest<DoctorDto>
Looks up the doctor profile associated with a specific user account.
Parameters
The user account identifier. Must be a non-empty GUID.
DoctorDto or throws EntityNotFoundException if no profile is linked to that user.
GetDoctorsBySpecialtyId
Type:IRequest<PaginatedList<DoctorDto>>
Returns a paginated list of doctors belonging to a given medical specialty. Only active (non-suspended) doctors are included.
Parameters
The specialty to filter by. Must be a non-empty GUID.
1-based page index. Must be ≥ 1.
Number of results per page. Must be between 1 and 100 (inclusive).
PaginatedList<DoctorDto> containing the matching doctors for the requested page.
Response Shape
DoctorDto
The unique identifier of the doctor profile.
The identity of the user account linked to this profile.
The doctor’s full name as a single formatted string (e.g.
"Dr. Jane Smith").Foreign key to the associated
MedicalSpecialty.The doctor’s official medical licence number.
The doctor’s professional biography.
The room number assigned to the doctor’s consultation space.
The label of the consultation room.
The floor on which the consultation room is located.