Files
2026-07-21 14:28:43 +07:00

26 lines
835 B
C#

using FluentValidation;
using Indotalent.Shared.Consts;
namespace Indotalent.Features.Thirdparty.Customer.Cqrs;
public class UpdateCustomerValidator : AbstractValidator<UpdateCustomerRequest>
{
public UpdateCustomerValidator()
{
RuleFor(x => x.Id)
.NotEmpty().WithMessage("ID is required for update");
RuleFor(x => x.Name)
.NotEmpty().WithMessage("Customer Name is required")
.MaximumLength(GlobalConsts.StringLengthShort);
RuleFor(x => x.EmailAddress)
.EmailAddress().When(x => !string.IsNullOrEmpty(x.EmailAddress));
RuleFor(x => x.CustomerGroupId)
.NotEmpty().WithMessage("Customer Group is required");
RuleFor(x => x.CustomerCategoryId)
.NotEmpty().WithMessage("Customer Category is required");
}
}