initial commit
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
using FluentValidation;
|
||||
using Indotalent.Shared.Consts;
|
||||
|
||||
namespace Indotalent.Features.Thirdparty.Customer.Cqrs;
|
||||
|
||||
public class CreateCustomerValidator : AbstractValidator<CreateCustomerRequest>
|
||||
{
|
||||
public CreateCustomerValidator()
|
||||
{
|
||||
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");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user