diff --git a/src/BackOffice.BFF.Application/DiscountCategoryCQ/Commands/CreateDiscountCategory/CreateDiscountCategoryCommandValidator.cs b/src/BackOffice.BFF.Application/DiscountCategoryCQ/Commands/CreateDiscountCategory/CreateDiscountCategoryCommandValidator.cs index 544c071..7909a42 100644 --- a/src/BackOffice.BFF.Application/DiscountCategoryCQ/Commands/CreateDiscountCategory/CreateDiscountCategoryCommandValidator.cs +++ b/src/BackOffice.BFF.Application/DiscountCategoryCQ/Commands/CreateDiscountCategory/CreateDiscountCategoryCommandValidator.cs @@ -14,6 +14,7 @@ public class CreateDiscountCategoryCommandValidator : AbstractValidator x.Description) - .MaximumLength(1000).WithMessage("توضیحات نباید بیشتر از 1000 کاراکتر باشد"); + .MaximumLength(1000).WithMessage("توضیحات نباید بیشتر از 1000 کاراکتر باشد") + .When(x => !string.IsNullOrEmpty(x.Description)); } } diff --git a/src/BackOffice.BFF.Application/DiscountCategoryCQ/Commands/UpdateDiscountCategory/UpdateDiscountCategoryCommandValidator.cs b/src/BackOffice.BFF.Application/DiscountCategoryCQ/Commands/UpdateDiscountCategory/UpdateDiscountCategoryCommandValidator.cs index 4b57a41..103eedb 100644 --- a/src/BackOffice.BFF.Application/DiscountCategoryCQ/Commands/UpdateDiscountCategory/UpdateDiscountCategoryCommandValidator.cs +++ b/src/BackOffice.BFF.Application/DiscountCategoryCQ/Commands/UpdateDiscountCategory/UpdateDiscountCategoryCommandValidator.cs @@ -17,7 +17,8 @@ public class UpdateDiscountCategoryCommandValidator : AbstractValidator x.Description) - .MaximumLength(1000).WithMessage("توضیحات نباید بیشتر از 1000 کاراکتر باشد"); + .MaximumLength(1000).WithMessage("توضیحات نباید بیشتر از 1000 کاراکتر باشد") + .When(x => !string.IsNullOrEmpty(x.Description)); RuleFor(x => x.ParentCategoryId) .NotEqual(x => x.CategoryId).When(x => x.ParentCategoryId.HasValue)