26 lines
826 B
C#
26 lines
826 B
C#
using FluentValidation;
|
|
using Indotalent.Shared.Consts;
|
|
|
|
namespace Indotalent.Features.Thirdparty.Patient.Cqrs;
|
|
|
|
public class UpdatePatientValidator : AbstractValidator<UpdatePatientRequest>
|
|
{
|
|
public UpdatePatientValidator()
|
|
{
|
|
RuleFor(x => x.Id)
|
|
.NotEmpty().WithMessage("ID is required for update");
|
|
|
|
RuleFor(x => x.Name)
|
|
.NotEmpty().WithMessage("Patient Name is required")
|
|
.MaximumLength(GlobalConsts.StringLengthShort);
|
|
|
|
RuleFor(x => x.EmailAddress)
|
|
.EmailAddress().When(x => !string.IsNullOrEmpty(x.EmailAddress));
|
|
|
|
RuleFor(x => x.PatientGroupId)
|
|
.NotEmpty().WithMessage("Patient Group is required");
|
|
|
|
RuleFor(x => x.PatientCategoryId)
|
|
.NotEmpty().WithMessage("Patient Category is required");
|
|
}
|
|
} |