initial commit
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user