Generator Changes at 11/17/2025 8:39:48 PM +03:30

This commit is contained in:
masoodafar-web
2025-11-17 20:42:57 +03:30
parent 76321f4297
commit 4f038d33f3
5 changed files with 64 additions and 22 deletions

View File

@@ -18,7 +18,7 @@ service ProductsContract
};
};
rpc GetAllProductsByFilter(GetAllProductsByFilterFilter) returns (GetAllProductsByFilterResponseModel){
rpc GetAllProductsByFilter(GetAllProductsByFilterRequest) returns (GetAllProductsByFilterResponse){
option (google.api.http) = {
get: "/GetAllProductsByFilter"
@@ -45,6 +45,12 @@ message GetProductsResponse
int32 view_count = 12;
int32 remaining_count = 13;
}
message GetAllProductsByFilterRequest
{
PaginationState pagination_state = 1;
google.protobuf.StringValue sort_by = 2;
GetAllProductsByFilterFilter filter = 3;
}
message GetAllProductsByFilterFilter
{
google.protobuf.Int64Value id = 1;
@@ -56,6 +62,11 @@ message GetAllProductsByFilterFilter
google.protobuf.Int32Value discount = 7;
google.protobuf.Int32Value rate = 8;
}
message GetAllProductsByFilterResponse
{
MetaData meta_data = 1;
repeated GetAllProductsByFilterResponseModel models = 2;
}
message GetAllProductsByFilterResponseModel
{
int64 id = 1;

View File

@@ -0,0 +1,17 @@
using FluentValidation;
using FrontOfficeMicroservice.Protobuf.Protos.Products;
namespace FrontOfficeMicroservice.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);
};
}