Generator Changes at 9/27/2025 8:46:36 AM

This commit is contained in:
generator
2025-09-27 08:46:36 +03:30
parent fd82e3edcf
commit fd8614f72e
261 changed files with 6333 additions and 0 deletions
@@ -0,0 +1,25 @@
using FluentValidation;
using CMSMicroservice.Protobuf.Protos.Package;
namespace CMSMicroservice.Protobuf.Validator.Package;
public class CreateNewPackageRequestValidator : AbstractValidator<CreateNewPackageRequest>
{
public CreateNewPackageRequestValidator()
{
RuleFor(model => model.Title)
.NotEmpty();
RuleFor(model => model.Description)
.NotEmpty();
RuleFor(model => model.ImagePath)
.NotEmpty();
RuleFor(model => model.Price)
.NotNull();
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{
var result = await ValidateAsync(ValidationContext<CreateNewPackageRequest>.CreateWithOptions((CreateNewPackageRequest)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.Package;
namespace CMSMicroservice.Protobuf.Validator.Package;
public class DeletePackageRequestValidator : AbstractValidator<DeletePackageRequest>
{
public DeletePackageRequestValidator()
{
RuleFor(model => model.Id)
.NotNull();
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{
var result = await ValidateAsync(ValidationContext<DeletePackageRequest>.CreateWithOptions((DeletePackageRequest)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.Package;
namespace CMSMicroservice.Protobuf.Validator.Package;
public class GetAllPackageByFilterRequestValidator : AbstractValidator<GetAllPackageByFilterRequest>
{
public GetAllPackageByFilterRequestValidator()
{
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{
var result = await ValidateAsync(ValidationContext<GetAllPackageByFilterRequest>.CreateWithOptions((GetAllPackageByFilterRequest)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.Package;
namespace CMSMicroservice.Protobuf.Validator.Package;
public class GetPackageRequestValidator : AbstractValidator<GetPackageRequest>
{
public GetPackageRequestValidator()
{
RuleFor(model => model.Id)
.NotNull();
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{
var result = await ValidateAsync(ValidationContext<GetPackageRequest>.CreateWithOptions((GetPackageRequest)model, x => x.IncludeProperties(propertyName)));
if (result.IsValid)
return Array.Empty<string>();
return result.Errors.Select(e => e.ErrorMessage);
};
}
@@ -0,0 +1,27 @@
using FluentValidation;
using CMSMicroservice.Protobuf.Protos.Package;
namespace CMSMicroservice.Protobuf.Validator.Package;
public class UpdatePackageRequestValidator : AbstractValidator<UpdatePackageRequest>
{
public UpdatePackageRequestValidator()
{
RuleFor(model => model.Id)
.NotNull();
RuleFor(model => model.Title)
.NotEmpty();
RuleFor(model => model.Description)
.NotEmpty();
RuleFor(model => model.ImagePath)
.NotEmpty();
RuleFor(model => model.Price)
.NotNull();
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{
var result = await ValidateAsync(ValidationContext<UpdatePackageRequest>.CreateWithOptions((UpdatePackageRequest)model, x => x.IncludeProperties(propertyName)));
if (result.IsValid)
return Array.Empty<string>();
return result.Errors.Select(e => e.ErrorMessage);
};
}