Generator Changes at 11/12/2025 1:32:03 AM +03:30

This commit is contained in:
masoodafar-web
2025-11-12 02:24:02 +03:30
parent 826ae4589f
commit b27c765731
290 changed files with 30811 additions and 21316 deletions
@@ -0,0 +1,23 @@
using FluentValidation;
using CMSMicroservice.Protobuf.Protos.ProductImages;
namespace CMSMicroservice.Protobuf.Validator.ProductImages;
public class CreateNewProductImagesRequestValidator : AbstractValidator<CreateNewProductImagesRequest>
{
public CreateNewProductImagesRequestValidator()
{
RuleFor(model => model.Title)
.NotEmpty();
RuleFor(model => model.ImagePath)
.NotEmpty();
RuleFor(model => model.ImageThumbnailPath)
.NotEmpty();
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{
var result = await ValidateAsync(ValidationContext<CreateNewProductImagesRequest>.CreateWithOptions((CreateNewProductImagesRequest)model, x => x.IncludeProperties(propertyName)));
if (result.IsValid)
return Array.Empty<string>();
return result.Errors.Select(e => e.ErrorMessage);
};
}
@@ -0,0 +1,19 @@
using FluentValidation;
using CMSMicroservice.Protobuf.Protos.ProductImages;
namespace CMSMicroservice.Protobuf.Validator.ProductImages;
public class DeleteProductImagesRequestValidator : AbstractValidator<DeleteProductImagesRequest>
{
public DeleteProductImagesRequestValidator()
{
RuleFor(model => model.Id)
.NotNull();
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{
var result = await ValidateAsync(ValidationContext<DeleteProductImagesRequest>.CreateWithOptions((DeleteProductImagesRequest)model, x => x.IncludeProperties(propertyName)));
if (result.IsValid)
return Array.Empty<string>();
return result.Errors.Select(e => e.ErrorMessage);
};
}
@@ -0,0 +1,17 @@
using FluentValidation;
using CMSMicroservice.Protobuf.Protos.ProductImages;
namespace CMSMicroservice.Protobuf.Validator.ProductImages;
public class GetAllProductImagesByFilterRequestValidator : AbstractValidator<GetAllProductImagesByFilterRequest>
{
public GetAllProductImagesByFilterRequestValidator()
{
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{
var result = await ValidateAsync(ValidationContext<GetAllProductImagesByFilterRequest>.CreateWithOptions((GetAllProductImagesByFilterRequest)model, x => x.IncludeProperties(propertyName)));
if (result.IsValid)
return Array.Empty<string>();
return result.Errors.Select(e => e.ErrorMessage);
};
}
@@ -0,0 +1,19 @@
using FluentValidation;
using CMSMicroservice.Protobuf.Protos.ProductImages;
namespace CMSMicroservice.Protobuf.Validator.ProductImages;
public class GetProductImagesRequestValidator : AbstractValidator<GetProductImagesRequest>
{
public GetProductImagesRequestValidator()
{
RuleFor(model => model.Id)
.NotNull();
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{
var result = await ValidateAsync(ValidationContext<GetProductImagesRequest>.CreateWithOptions((GetProductImagesRequest)model, x => x.IncludeProperties(propertyName)));
if (result.IsValid)
return Array.Empty<string>();
return result.Errors.Select(e => e.ErrorMessage);
};
}
@@ -0,0 +1,25 @@
using FluentValidation;
using CMSMicroservice.Protobuf.Protos.ProductImages;
namespace CMSMicroservice.Protobuf.Validator.ProductImages;
public class UpdateProductImagesRequestValidator : AbstractValidator<UpdateProductImagesRequest>
{
public UpdateProductImagesRequestValidator()
{
RuleFor(model => model.Id)
.NotNull();
RuleFor(model => model.Title)
.NotEmpty();
RuleFor(model => model.ImagePath)
.NotEmpty();
RuleFor(model => model.ImageThumbnailPath)
.NotEmpty();
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{
var result = await ValidateAsync(ValidationContext<UpdateProductImagesRequest>.CreateWithOptions((UpdateProductImagesRequest)model, x => x.IncludeProperties(propertyName)));
if (result.IsValid)
return Array.Empty<string>();
return result.Errors.Select(e => e.ErrorMessage);
};
}