Generator Changes at 11/12/2025 1:32:03 AM +03:30
This commit is contained in:
+31
@@ -0,0 +1,31 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.FactorDetails;
|
||||
namespace CMSMicroservice.Protobuf.Validator.FactorDetails;
|
||||
|
||||
public class CreateNewFactorDetailsRequestValidator : AbstractValidator<CreateNewFactorDetailsRequest>
|
||||
{
|
||||
public CreateNewFactorDetailsRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.ProductId)
|
||||
.NotNull();
|
||||
RuleFor(model => model.Count)
|
||||
.NotNull();
|
||||
RuleFor(model => model.UnitPrice)
|
||||
.NotNull();
|
||||
RuleFor(model => model.UnitDiscount)
|
||||
.NotNull();
|
||||
RuleFor(model => model.OrderId)
|
||||
.NotNull();
|
||||
RuleFor(model => model.UnitDiscountPrice)
|
||||
.NotNull();
|
||||
RuleFor(model => model.IsChangePrice)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<CreateNewFactorDetailsRequest>.CreateWithOptions((CreateNewFactorDetailsRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.FactorDetails;
|
||||
namespace CMSMicroservice.Protobuf.Validator.FactorDetails;
|
||||
|
||||
public class DeleteFactorDetailsRequestValidator : AbstractValidator<DeleteFactorDetailsRequest>
|
||||
{
|
||||
public DeleteFactorDetailsRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<DeleteFactorDetailsRequest>.CreateWithOptions((DeleteFactorDetailsRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.FactorDetails;
|
||||
namespace CMSMicroservice.Protobuf.Validator.FactorDetails;
|
||||
|
||||
public class GetAllFactorDetailsByFilterRequestValidator : AbstractValidator<GetAllFactorDetailsByFilterRequest>
|
||||
{
|
||||
public GetAllFactorDetailsByFilterRequestValidator()
|
||||
{
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<GetAllFactorDetailsByFilterRequest>.CreateWithOptions((GetAllFactorDetailsByFilterRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.FactorDetails;
|
||||
namespace CMSMicroservice.Protobuf.Validator.FactorDetails;
|
||||
|
||||
public class GetFactorDetailsRequestValidator : AbstractValidator<GetFactorDetailsRequest>
|
||||
{
|
||||
public GetFactorDetailsRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<GetFactorDetailsRequest>.CreateWithOptions((GetFactorDetailsRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.FactorDetails;
|
||||
namespace CMSMicroservice.Protobuf.Validator.FactorDetails;
|
||||
|
||||
public class UpdateFactorDetailsRequestValidator : AbstractValidator<UpdateFactorDetailsRequest>
|
||||
{
|
||||
public UpdateFactorDetailsRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
RuleFor(model => model.ProductId)
|
||||
.NotNull();
|
||||
RuleFor(model => model.Count)
|
||||
.NotNull();
|
||||
RuleFor(model => model.UnitPrice)
|
||||
.NotNull();
|
||||
RuleFor(model => model.UnitDiscount)
|
||||
.NotNull();
|
||||
RuleFor(model => model.OrderId)
|
||||
.NotNull();
|
||||
RuleFor(model => model.UnitDiscountPrice)
|
||||
.NotNull();
|
||||
RuleFor(model => model.IsChangePrice)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<UpdateFactorDetailsRequest>.CreateWithOptions((UpdateFactorDetailsRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.ProductGallerys;
|
||||
namespace CMSMicroservice.Protobuf.Validator.ProductGallerys;
|
||||
|
||||
public class CreateNewProductGallerysRequestValidator : AbstractValidator<CreateNewProductGallerysRequest>
|
||||
{
|
||||
public CreateNewProductGallerysRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.ProductImageId)
|
||||
.NotNull();
|
||||
RuleFor(model => model.ProductId)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<CreateNewProductGallerysRequest>.CreateWithOptions((CreateNewProductGallerysRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.ProductGallerys;
|
||||
namespace CMSMicroservice.Protobuf.Validator.ProductGallerys;
|
||||
|
||||
public class DeleteProductGallerysRequestValidator : AbstractValidator<DeleteProductGallerysRequest>
|
||||
{
|
||||
public DeleteProductGallerysRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<DeleteProductGallerysRequest>.CreateWithOptions((DeleteProductGallerysRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.ProductGallerys;
|
||||
namespace CMSMicroservice.Protobuf.Validator.ProductGallerys;
|
||||
|
||||
public class GetAllProductGallerysByFilterRequestValidator : AbstractValidator<GetAllProductGallerysByFilterRequest>
|
||||
{
|
||||
public GetAllProductGallerysByFilterRequestValidator()
|
||||
{
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<GetAllProductGallerysByFilterRequest>.CreateWithOptions((GetAllProductGallerysByFilterRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.ProductGallerys;
|
||||
namespace CMSMicroservice.Protobuf.Validator.ProductGallerys;
|
||||
|
||||
public class GetProductGallerysRequestValidator : AbstractValidator<GetProductGallerysRequest>
|
||||
{
|
||||
public GetProductGallerysRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<GetProductGallerysRequest>.CreateWithOptions((GetProductGallerysRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.ProductGallerys;
|
||||
namespace CMSMicroservice.Protobuf.Validator.ProductGallerys;
|
||||
|
||||
public class UpdateProductGallerysRequestValidator : AbstractValidator<UpdateProductGallerysRequest>
|
||||
{
|
||||
public UpdateProductGallerysRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
RuleFor(model => model.ProductImageId)
|
||||
.NotNull();
|
||||
RuleFor(model => model.ProductId)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<UpdateProductGallerysRequest>.CreateWithOptions((UpdateProductGallerysRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
+23
@@ -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);
|
||||
};
|
||||
}
|
||||
+19
@@ -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);
|
||||
};
|
||||
}
|
||||
+17
@@ -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);
|
||||
};
|
||||
}
|
||||
+19
@@ -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);
|
||||
};
|
||||
}
|
||||
+25
@@ -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);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.Products;
|
||||
namespace CMSMicroservice.Protobuf.Validator.Products;
|
||||
|
||||
public class CreateNewProductsRequestValidator : AbstractValidator<CreateNewProductsRequest>
|
||||
{
|
||||
public CreateNewProductsRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Title)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.Description)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.ShortInfomation)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.FullInformation)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.Price)
|
||||
.NotNull();
|
||||
RuleFor(model => model.Discount)
|
||||
.NotNull();
|
||||
RuleFor(model => model.Rate)
|
||||
.NotNull();
|
||||
RuleFor(model => model.ImagePath)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.ThumbnailPath)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.SaleCount)
|
||||
.NotNull();
|
||||
RuleFor(model => model.ViewCount)
|
||||
.NotNull();
|
||||
RuleFor(model => model.RemainingCount)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<CreateNewProductsRequest>.CreateWithOptions((CreateNewProductsRequest)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.Products;
|
||||
namespace CMSMicroservice.Protobuf.Validator.Products;
|
||||
|
||||
public class DeleteProductsRequestValidator : AbstractValidator<DeleteProductsRequest>
|
||||
{
|
||||
public DeleteProductsRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<DeleteProductsRequest>.CreateWithOptions((DeleteProductsRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.Products;
|
||||
namespace CMSMicroservice.Protobuf.Validator.Products;
|
||||
|
||||
public class GetAllProductsByFilterRequestValidator : AbstractValidator<GetAllProductsByFilterRequest>
|
||||
{
|
||||
public GetAllProductsByFilterRequestValidator()
|
||||
{
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<GetAllProductsByFilterRequest>.CreateWithOptions((GetAllProductsByFilterRequest)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.Products;
|
||||
namespace CMSMicroservice.Protobuf.Validator.Products;
|
||||
|
||||
public class GetProductsRequestValidator : AbstractValidator<GetProductsRequest>
|
||||
{
|
||||
public GetProductsRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<GetProductsRequest>.CreateWithOptions((GetProductsRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.Products;
|
||||
namespace CMSMicroservice.Protobuf.Validator.Products;
|
||||
|
||||
public class UpdateProductsRequestValidator : AbstractValidator<UpdateProductsRequest>
|
||||
{
|
||||
public UpdateProductsRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
RuleFor(model => model.Title)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.Description)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.ShortInfomation)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.FullInformation)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.Price)
|
||||
.NotNull();
|
||||
RuleFor(model => model.Discount)
|
||||
.NotNull();
|
||||
RuleFor(model => model.Rate)
|
||||
.NotNull();
|
||||
RuleFor(model => model.ImagePath)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.ThumbnailPath)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.SaleCount)
|
||||
.NotNull();
|
||||
RuleFor(model => model.ViewCount)
|
||||
.NotNull();
|
||||
RuleFor(model => model.RemainingCount)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<UpdateProductsRequest>.CreateWithOptions((UpdateProductsRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.Transactions;
|
||||
namespace CMSMicroservice.Protobuf.Validator.Transactions;
|
||||
|
||||
public class CreateNewTransactionsRequestValidator : AbstractValidator<CreateNewTransactionsRequest>
|
||||
{
|
||||
public CreateNewTransactionsRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.MerchantId)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.Amount)
|
||||
.NotNull();
|
||||
RuleFor(model => model.CallbackUrl)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.Description)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.PaymentStatus)
|
||||
.IsInEnum()
|
||||
.NotNull();
|
||||
RuleFor(model => model.Type)
|
||||
.IsInEnum()
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<CreateNewTransactionsRequest>.CreateWithOptions((CreateNewTransactionsRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.Transactions;
|
||||
namespace CMSMicroservice.Protobuf.Validator.Transactions;
|
||||
|
||||
public class DeleteTransactionsRequestValidator : AbstractValidator<DeleteTransactionsRequest>
|
||||
{
|
||||
public DeleteTransactionsRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<DeleteTransactionsRequest>.CreateWithOptions((DeleteTransactionsRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.Transactions;
|
||||
namespace CMSMicroservice.Protobuf.Validator.Transactions;
|
||||
|
||||
public class GetAllTransactionsByFilterRequestValidator : AbstractValidator<GetAllTransactionsByFilterRequest>
|
||||
{
|
||||
public GetAllTransactionsByFilterRequestValidator()
|
||||
{
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<GetAllTransactionsByFilterRequest>.CreateWithOptions((GetAllTransactionsByFilterRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.Transactions;
|
||||
namespace CMSMicroservice.Protobuf.Validator.Transactions;
|
||||
|
||||
public class GetTransactionsRequestValidator : AbstractValidator<GetTransactionsRequest>
|
||||
{
|
||||
public GetTransactionsRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<GetTransactionsRequest>.CreateWithOptions((GetTransactionsRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.Transactions;
|
||||
namespace CMSMicroservice.Protobuf.Validator.Transactions;
|
||||
|
||||
public class UpdateTransactionsRequestValidator : AbstractValidator<UpdateTransactionsRequest>
|
||||
{
|
||||
public UpdateTransactionsRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
RuleFor(model => model.MerchantId)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.Amount)
|
||||
.NotNull();
|
||||
RuleFor(model => model.CallbackUrl)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.Description)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.PaymentStatus)
|
||||
.IsInEnum()
|
||||
.NotNull();
|
||||
RuleFor(model => model.Type)
|
||||
.IsInEnum()
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<UpdateTransactionsRequest>.CreateWithOptions((UpdateTransactionsRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.UserCarts;
|
||||
namespace CMSMicroservice.Protobuf.Validator.UserCarts;
|
||||
|
||||
public class CreateNewUserCartsRequestValidator : AbstractValidator<CreateNewUserCartsRequest>
|
||||
{
|
||||
public CreateNewUserCartsRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.ProductId)
|
||||
.NotNull();
|
||||
RuleFor(model => model.UserId)
|
||||
.NotNull();
|
||||
RuleFor(model => model.Count)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<CreateNewUserCartsRequest>.CreateWithOptions((CreateNewUserCartsRequest)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.UserCarts;
|
||||
namespace CMSMicroservice.Protobuf.Validator.UserCarts;
|
||||
|
||||
public class DeleteUserCartsRequestValidator : AbstractValidator<DeleteUserCartsRequest>
|
||||
{
|
||||
public DeleteUserCartsRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<DeleteUserCartsRequest>.CreateWithOptions((DeleteUserCartsRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.UserCarts;
|
||||
namespace CMSMicroservice.Protobuf.Validator.UserCarts;
|
||||
|
||||
public class GetAllUserCartsByFilterRequestValidator : AbstractValidator<GetAllUserCartsByFilterRequest>
|
||||
{
|
||||
public GetAllUserCartsByFilterRequestValidator()
|
||||
{
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<GetAllUserCartsByFilterRequest>.CreateWithOptions((GetAllUserCartsByFilterRequest)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.UserCarts;
|
||||
namespace CMSMicroservice.Protobuf.Validator.UserCarts;
|
||||
|
||||
public class GetUserCartsRequestValidator : AbstractValidator<GetUserCartsRequest>
|
||||
{
|
||||
public GetUserCartsRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<GetUserCartsRequest>.CreateWithOptions((GetUserCartsRequest)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.UserCarts;
|
||||
namespace CMSMicroservice.Protobuf.Validator.UserCarts;
|
||||
|
||||
public class UpdateUserCartsRequestValidator : AbstractValidator<UpdateUserCartsRequest>
|
||||
{
|
||||
public UpdateUserCartsRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
RuleFor(model => model.ProductId)
|
||||
.NotNull();
|
||||
RuleFor(model => model.UserId)
|
||||
.NotNull();
|
||||
RuleFor(model => model.Count)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<UpdateUserCartsRequest>.CreateWithOptions((UpdateUserCartsRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.UserWallet;
|
||||
namespace CMSMicroservice.Protobuf.Validator.UserWallet;
|
||||
|
||||
public class CreateNewUserWalletRequestValidator : AbstractValidator<CreateNewUserWalletRequest>
|
||||
{
|
||||
public CreateNewUserWalletRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.UserId)
|
||||
.NotNull();
|
||||
RuleFor(model => model.Balance)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<CreateNewUserWalletRequest>.CreateWithOptions((CreateNewUserWalletRequest)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.UserWallet;
|
||||
namespace CMSMicroservice.Protobuf.Validator.UserWallet;
|
||||
|
||||
public class DeleteUserWalletRequestValidator : AbstractValidator<DeleteUserWalletRequest>
|
||||
{
|
||||
public DeleteUserWalletRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<DeleteUserWalletRequest>.CreateWithOptions((DeleteUserWalletRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.UserWallet;
|
||||
namespace CMSMicroservice.Protobuf.Validator.UserWallet;
|
||||
|
||||
public class GetAllUserWalletByFilterRequestValidator : AbstractValidator<GetAllUserWalletByFilterRequest>
|
||||
{
|
||||
public GetAllUserWalletByFilterRequestValidator()
|
||||
{
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<GetAllUserWalletByFilterRequest>.CreateWithOptions((GetAllUserWalletByFilterRequest)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.UserWallet;
|
||||
namespace CMSMicroservice.Protobuf.Validator.UserWallet;
|
||||
|
||||
public class GetUserWalletRequestValidator : AbstractValidator<GetUserWalletRequest>
|
||||
{
|
||||
public GetUserWalletRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<GetUserWalletRequest>.CreateWithOptions((GetUserWalletRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.UserWallet;
|
||||
namespace CMSMicroservice.Protobuf.Validator.UserWallet;
|
||||
|
||||
public class UpdateUserWalletRequestValidator : AbstractValidator<UpdateUserWalletRequest>
|
||||
{
|
||||
public UpdateUserWalletRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
RuleFor(model => model.UserId)
|
||||
.NotNull();
|
||||
RuleFor(model => model.Balance)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<UpdateUserWalletRequest>.CreateWithOptions((UpdateUserWalletRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.UserWalletChangeLog;
|
||||
namespace CMSMicroservice.Protobuf.Validator.UserWalletChangeLog;
|
||||
|
||||
public class CreateNewUserWalletChangeLogRequestValidator : AbstractValidator<CreateNewUserWalletChangeLogRequest>
|
||||
{
|
||||
public CreateNewUserWalletChangeLogRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.WalletId)
|
||||
.NotNull();
|
||||
RuleFor(model => model.CurrentBalance)
|
||||
.NotNull();
|
||||
RuleFor(model => model.ChangeValue)
|
||||
.NotNull();
|
||||
RuleFor(model => model.IsIncrease)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<CreateNewUserWalletChangeLogRequest>.CreateWithOptions((CreateNewUserWalletChangeLogRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.UserWalletChangeLog;
|
||||
namespace CMSMicroservice.Protobuf.Validator.UserWalletChangeLog;
|
||||
|
||||
public class DeleteUserWalletChangeLogRequestValidator : AbstractValidator<DeleteUserWalletChangeLogRequest>
|
||||
{
|
||||
public DeleteUserWalletChangeLogRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<DeleteUserWalletChangeLogRequest>.CreateWithOptions((DeleteUserWalletChangeLogRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.UserWalletChangeLog;
|
||||
namespace CMSMicroservice.Protobuf.Validator.UserWalletChangeLog;
|
||||
|
||||
public class GetAllUserWalletChangeLogByFilterRequestValidator : AbstractValidator<GetAllUserWalletChangeLogByFilterRequest>
|
||||
{
|
||||
public GetAllUserWalletChangeLogByFilterRequestValidator()
|
||||
{
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<GetAllUserWalletChangeLogByFilterRequest>.CreateWithOptions((GetAllUserWalletChangeLogByFilterRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.UserWalletChangeLog;
|
||||
namespace CMSMicroservice.Protobuf.Validator.UserWalletChangeLog;
|
||||
|
||||
public class GetUserWalletChangeLogRequestValidator : AbstractValidator<GetUserWalletChangeLogRequest>
|
||||
{
|
||||
public GetUserWalletChangeLogRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<GetUserWalletChangeLogRequest>.CreateWithOptions((GetUserWalletChangeLogRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.UserWalletChangeLog;
|
||||
namespace CMSMicroservice.Protobuf.Validator.UserWalletChangeLog;
|
||||
|
||||
public class UpdateUserWalletChangeLogRequestValidator : AbstractValidator<UpdateUserWalletChangeLogRequest>
|
||||
{
|
||||
public UpdateUserWalletChangeLogRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
RuleFor(model => model.WalletId)
|
||||
.NotNull();
|
||||
RuleFor(model => model.CurrentBalance)
|
||||
.NotNull();
|
||||
RuleFor(model => model.ChangeValue)
|
||||
.NotNull();
|
||||
RuleFor(model => model.IsIncrease)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<UpdateUserWalletChangeLogRequest>.CreateWithOptions((UpdateUserWalletChangeLogRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user