26 lines
1.1 KiB
C#
26 lines
1.1 KiB
C#
using FluentValidation;
|
|
using Indotalent.Shared.Consts;
|
|
|
|
namespace Indotalent.Features.Profile.PersonalInformation.Cqrs;
|
|
|
|
public class UpdateProfileValidator : AbstractValidator<UpdateProfileRequest>
|
|
{
|
|
public UpdateProfileValidator()
|
|
{
|
|
RuleFor(x => x.Id).NotEmpty();
|
|
|
|
RuleFor(x => x.FirstName)
|
|
.NotEmpty().WithMessage("First name is required")
|
|
.MaximumLength(GlobalConsts.StringLengthShort).WithMessage($"First name cannot exceed {GlobalConsts.StringLengthShort} characters");
|
|
|
|
RuleFor(x => x.LastName)
|
|
.NotEmpty().WithMessage("Last name is required")
|
|
.MaximumLength(GlobalConsts.StringLengthShort).WithMessage($"Last name cannot exceed {GlobalConsts.StringLengthShort} characters");
|
|
|
|
RuleFor(x => x.PhoneNumber)
|
|
.MaximumLength(GlobalConsts.StringLengthShort).WithMessage($"Phone cannot exceed {GlobalConsts.StringLengthShort} characters");
|
|
|
|
RuleFor(x => x.ShortBio)
|
|
.MaximumLength(GlobalConsts.StringLengthShort).WithMessage($"Bio cannot exceed {GlobalConsts.StringLengthShort} characters");
|
|
}
|
|
} |