Skip to main content

Documentation 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.

The Doctors module exposes four commands and three queries built on MediatR’s 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.
public sealed record CreateDoctorProfileCommand(
    Guid UserId,
    string FirstName,
    string LastName,
    string LicenseNumber,
    Guid MedicalSpecialtyId,
    string Biography,
    int ConsultationRoomNumber,
    string ConsultationRoomName,
    int ConsultationRoomFloor
) : IRequest<Guid>;

Parameters

UserId
Guid
required
The identity of the application user account that will own this doctor profile. Must be a non-empty GUID.
FirstName
string
required
The doctor’s given name. Combined with LastName to form the PersonName value object. Must satisfy PersonName.MinimumLength and PersonName.MaximumLength.
LastName
string
required
The doctor’s family name. Same length constraints as FirstName.
LicenseNumber
string
required
The official medical licence number. Must be between MedicalLicenseNumber.MinimumLength and MedicalLicenseNumber.MaximumLength characters. Checked for global uniqueness (including soft-deleted profiles).
MedicalSpecialtyId
Guid
required
Reference to an existing MedicalSpecialty record. Must be a non-empty GUID.
Biography
string
required
Free-text professional summary displayed on the doctor’s public profile.
ConsultationRoomNumber
int
required
Physical room number. Validated between ConsultationRoom.MinimumNumber and ConsultationRoom.MaximumNumber.
ConsultationRoomName
string
required
Human-readable label for the consultation room (e.g. "Room A"). Must not be empty.
ConsultationRoomFloor
int
required
Floor number of the consultation room. Validated between ConsultationRoom.MinimumFloor and ConsultationRoom.MaximumFloor.
Returns: The newly created 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.
public sealed record UpdateDoctorProfileCommand(
    Guid DoctorId,
    string Biography,
    int ConsultationRoomNumber,
    string ConsultationRoomName,
    int ConsultationRoomFloor
) : IRequest;

Parameters

DoctorId
Guid
required
ID of the doctor profile to update. Must be a non-empty GUID.
Biography
string
required
Replacement biography text. No length restriction enforced at the application layer.
ConsultationRoomNumber
int
required
New room number. Same bounds as CreateDoctorProfile.
ConsultationRoomName
string
required
New room label. Must not be empty.
ConsultationRoomFloor
int
required
New floor number. Same bounds as CreateDoctorProfile.
Returns: 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.
public sealed record SuspendDoctorProfileCommand(Guid DoctorId) : IRequest;
Automatic appointment displacement: Publishing DoctorSuspendedEvent triggers DoctorSuspendedEventHandler, which marks all future scheduled appointments for that doctor as RequiresReassignment. A second handler, DeactivateDoctorSchedulesEventHandler, simultaneously deactivates all of the doctor’s active schedule slots. Both side-effects run in separate transactions after the suspension is persisted.

Parameters

DoctorId
Guid
required
ID of the doctor to suspend. Throws EntityNotFoundException if no active doctor is found. Throws BusinessRuleValidationException if the doctor is already suspended.
Returns: 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.
public sealed record ReactivateDoctorProfileCommand(
    Guid DoctorId,
    string Biography,
    int ConsultationRoomNumber,
    string ConsultationRoomName,
    int ConsultationRoomFloor
) : IRequest;

Parameters

DoctorId
Guid
required
ID of the suspended doctor to reactivate.
Biography
string
required
Updated biography to set on reactivation.
ConsultationRoomNumber
int
required
Replacement room number. Same bounds as CreateDoctorProfile.
ConsultationRoomName
string
required
Replacement room label. Must not be empty.
ConsultationRoomFloor
int
required
Replacement floor number. Same bounds as CreateDoctorProfile.
Returns: Unit (void).

Queries

GetDoctorById

Type: IRequest<DoctorDto> Fetches a single doctor profile by its primary key.
public sealed record GetDoctorByIdQuery(Guid DoctorId) : IRequest<DoctorDto>;

Parameters

DoctorId
Guid
required
The primary key of the doctor to retrieve. Must be a non-empty GUID.
Returns: A DoctorDto or throws EntityNotFoundException if no matching record exists.

GetDoctorByUserId

Type: IRequest<DoctorDto> Looks up the doctor profile associated with a specific user account.
public sealed record GetDoctorByUserIdQuery(Guid UserId) : IRequest<DoctorDto>;

Parameters

UserId
Guid
required
The user account identifier. Must be a non-empty GUID.
Returns: A 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.
public sealed record GetDoctorsBySpecialtyIdQuery(
    Guid SpecialtyId,
    int PageNumber,
    int PageSize
) : IRequest<PaginatedList<DoctorDto>>;

Parameters

SpecialtyId
Guid
required
The specialty to filter by. Must be a non-empty GUID.
PageNumber
int
required
1-based page index. Must be ≥ 1.
PageSize
int
required
Number of results per page. Must be between 1 and 100 (inclusive).
Returns: A PaginatedList<DoctorDto> containing the matching doctors for the requested page.

Response Shape

DoctorDto

public sealed record DoctorDto(
    Guid Id,
    Guid UserId,
    string FullName,
    Guid MedicalSpecialtyId,
    string LicenseNumber,
    string Biography,
    int ConsultationRoomNumber,
    string ConsultationRoomName,
    int ConsultationRoomFloor
);
Id
Guid
The unique identifier of the doctor profile.
UserId
Guid
The identity of the user account linked to this profile.
FullName
string
The doctor’s full name as a single formatted string (e.g. "Dr. Jane Smith").
MedicalSpecialtyId
Guid
Foreign key to the associated MedicalSpecialty.
LicenseNumber
string
The doctor’s official medical licence number.
Biography
string
The doctor’s professional biography.
ConsultationRoomNumber
int
The room number assigned to the doctor’s consultation space.
ConsultationRoomName
string
The label of the consultation room.
ConsultationRoomFloor
int
The floor on which the consultation room is located.

Build docs developers (and LLMs) love