using FluentValidation; namespace CMSMicroservice.Application.BlogPostCQ.Commands.UpdateBlogPost; public class UpdateBlogPostCommandValidator : AbstractValidator { public UpdateBlogPostCommandValidator() { RuleFor(x => x.Id).GreaterThan(0).WithMessage("شناسه مقاله نامعتبر است"); RuleFor(x => x.Title) .NotEmpty().WithMessage("عنوان مقاله الزامی است") .MaximumLength(200).WithMessage("عنوان نمی‌تواند بیشتر از 200 کاراکتر باشد"); RuleFor(x => x.Slug) .NotEmpty().WithMessage("نشانی یکتا (slug) الزامی است") .MaximumLength(200).WithMessage("نشانی نمی‌تواند بیشتر از 200 کاراکتر باشد") .Matches(@"^[a-z0-9\-]+$").WithMessage("نشانی فقط می‌تواند شامل حروف کوچک انگلیسی، اعداد و خط تیره باشد"); RuleFor(x => x.HtmlContent) .NotEmpty().WithMessage("محتوای مقاله الزامی است"); } }