23 lines
731 B
C#
23 lines
731 B
C#
using FluentValidation;
|
|
using Indotalent.Shared.Consts;
|
|
|
|
namespace Indotalent.Features.Thirdparty.PatientContact.Cqrs;
|
|
|
|
public class UpdatePatientContactValidator : AbstractValidator<UpdatePatientContactRequest>
|
|
{
|
|
public UpdatePatientContactValidator()
|
|
{
|
|
RuleFor(x => x.Id)
|
|
.NotEmpty().WithMessage("ID is required for update");
|
|
|
|
RuleFor(x => x.Name)
|
|
.NotEmpty().WithMessage("Contact Name is required")
|
|
.MaximumLength(GlobalConsts.StringLengthShort);
|
|
|
|
RuleFor(x => x.PatientId)
|
|
.NotEmpty().WithMessage("Patient is required");
|
|
|
|
RuleFor(x => x.EmailAddress)
|
|
.EmailAddress().When(x => !string.IsNullOrEmpty(x.EmailAddress));
|
|
}
|
|
} |