Files
2026-07-21 14:08:10 +07:00

30 lines
937 B
C#

using FluentValidation;
using Indotalent.Shared.Consts;
namespace Indotalent.Features.Organization.Branch.Cqrs;
public class UpdateBranchValidator : AbstractValidator<UpdateBranchRequest>
{
public UpdateBranchValidator()
{
RuleFor(x => x.Id)
.NotEmpty().WithMessage("ID is required for update");
RuleFor(x => x.Code)
.NotEmpty().WithMessage("Branch Code is required")
.MaximumLength(GlobalConsts.StringLengthShort);
RuleFor(x => x.Name)
.NotEmpty().WithMessage("Branch Name is required")
.MaximumLength(GlobalConsts.StringLengthShort);
RuleFor(x => x.City)
.NotEmpty().WithMessage("City is required");
RuleFor(x => x.StreetAddress)
.NotEmpty().WithMessage("Street Address is required");
RuleFor(x => x.Email)
.EmailAddress().When(x => !string.IsNullOrEmpty(x.Email));
}
}