fix: Missing input validators + No patient update endpoint + Pagination inconsistencies + Missing list/get endpoints
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using FluentValidation;
|
||||
|
||||
public class UpdatePatientRequestValidator : AbstractValidator<UpdatePatientRequest>
|
||||
{
|
||||
public UpdatePatientRequestValidator()
|
||||
{
|
||||
RuleFor(x => x.FirstName).MaximumLength(100)
|
||||
.When(x => x.FirstName is not null);
|
||||
RuleFor(x => x.LastName).MaximumLength(100)
|
||||
.When(x => x.LastName is not null);
|
||||
RuleFor(x => x.DateOfBirth)
|
||||
.LessThanOrEqualTo(DateOnly.FromDateTime(DateTime.UtcNow))
|
||||
.WithMessage("Date of birth cannot be in the future.")
|
||||
.When(x => x.DateOfBirth is not null);
|
||||
RuleFor(x => x.Gender).MaximumLength(10)
|
||||
.When(x => x.Gender is not null);
|
||||
RuleFor(x => x.BloodType).IsInEnum()
|
||||
.When(x => x.BloodType is not null);
|
||||
RuleFor(x => x.EmergencyContactName).MaximumLength(200)
|
||||
.When(x => x.EmergencyContactName is not null);
|
||||
RuleFor(x => x.EmergencyContactPhone).MaximumLength(20)
|
||||
.When(x => x.EmergencyContactPhone is not null);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user