Generator Changes at 11/17/2025 8:39:48 PM +03:30
This commit is contained in:
@@ -1,21 +1,29 @@
|
|||||||
namespace FrontOffice.BFF.Application.ProductsCQ.Queries.GetAllProductsByFilter;
|
namespace FrontOffice.BFF.Application.ProductsCQ.Queries.GetAllProductsByFilter;
|
||||||
public record GetAllProductsByFilterQuery : IRequest<GetAllProductsByFilterResponseDto>
|
public record GetAllProductsByFilterQuery : IRequest<GetAllProductsByFilterResponseDto>
|
||||||
{
|
{
|
||||||
//
|
//موقعیت صفحه بندی
|
||||||
public long? Id { get; init; }
|
public PaginationState? PaginationState { get; init; }
|
||||||
//
|
//مرتب سازی بر اساس
|
||||||
public string? Title { get; init; }
|
public string? SortBy { get; init; }
|
||||||
//
|
//فیلتر
|
||||||
public string? Description { get; init; }
|
public GetAllProductsByFilterFilter? Filter { get; init; }
|
||||||
//
|
|
||||||
public string? ShortInfomation { get; init; }
|
|
||||||
//
|
|
||||||
public string? FullInformation { get; init; }
|
|
||||||
//
|
|
||||||
public long? Price { get; init; }
|
|
||||||
//
|
|
||||||
public int? Discount { get; init; }
|
|
||||||
//
|
|
||||||
public int? Rate { get; init; }
|
|
||||||
|
|
||||||
}
|
}public class GetAllProductsByFilterFilter
|
||||||
|
{
|
||||||
|
//
|
||||||
|
public long? Id { get; set; }
|
||||||
|
//
|
||||||
|
public string? Title { get; set; }
|
||||||
|
//
|
||||||
|
public string? Description { get; set; }
|
||||||
|
//
|
||||||
|
public string? ShortInfomation { get; set; }
|
||||||
|
//
|
||||||
|
public string? FullInformation { get; set; }
|
||||||
|
//
|
||||||
|
public long? Price { get; set; }
|
||||||
|
//
|
||||||
|
public int? Discount { get; set; }
|
||||||
|
//
|
||||||
|
public int? Rate { get; set; }
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
namespace FrontOffice.BFF.Application.ProductsCQ.Queries.GetAllProductsByFilter;
|
namespace FrontOffice.BFF.Application.ProductsCQ.Queries.GetAllProductsByFilter;
|
||||||
public class GetAllProductsByFilterResponseDto
|
public class GetAllProductsByFilterResponseDto
|
||||||
|
{
|
||||||
|
//متادیتا
|
||||||
|
public MetaData MetaData { get; set; }
|
||||||
|
//مدل خروجی
|
||||||
|
public List<GetAllProductsByFilterResponseModel>? Models { get; set; }
|
||||||
|
|
||||||
|
}public class GetAllProductsByFilterResponseModel
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
public long Id { get; set; }
|
public long Id { get; set; }
|
||||||
@@ -27,5 +34,4 @@ public class GetAllProductsByFilterResponseDto
|
|||||||
public int ViewCount { get; set; }
|
public int ViewCount { get; set; }
|
||||||
//
|
//
|
||||||
public int RemainingCount { get; set; }
|
public int RemainingCount { get; set; }
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ public class ProductsService : ProductsContract.ProductsContractBase
|
|||||||
{
|
{
|
||||||
return await _dispatchRequestToCQRS.Handle<GetProductsRequest, GetProductsQuery, GetProductsResponse>(request, context);
|
return await _dispatchRequestToCQRS.Handle<GetProductsRequest, GetProductsQuery, GetProductsResponse>(request, context);
|
||||||
}
|
}
|
||||||
public override async Task<GetAllProductsByFilterResponseModel> GetAllProductsByFilter(GetAllProductsByFilterFilter request, ServerCallContext context)
|
public override async Task<GetAllProductsByFilterResponse> GetAllProductsByFilter(GetAllProductsByFilterRequest request, ServerCallContext context)
|
||||||
{
|
{
|
||||||
return await _dispatchRequestToCQRS.Handle<GetAllProductsByFilterFilter, GetAllProductsByFilterQuery, GetAllProductsByFilterResponseModel>(request, context);
|
return await _dispatchRequestToCQRS.Handle<GetAllProductsByFilterRequest, GetAllProductsByFilterQuery, GetAllProductsByFilterResponse>(request, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ service ProductsContract
|
|||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
rpc GetAllProductsByFilter(GetAllProductsByFilterFilter) returns (GetAllProductsByFilterResponseModel){
|
rpc GetAllProductsByFilter(GetAllProductsByFilterRequest) returns (GetAllProductsByFilterResponse){
|
||||||
option (google.api.http) = {
|
option (google.api.http) = {
|
||||||
get: "/GetAllProductsByFilter"
|
get: "/GetAllProductsByFilter"
|
||||||
|
|
||||||
@@ -45,6 +45,12 @@ message GetProductsResponse
|
|||||||
int32 view_count = 12;
|
int32 view_count = 12;
|
||||||
int32 remaining_count = 13;
|
int32 remaining_count = 13;
|
||||||
}
|
}
|
||||||
|
message GetAllProductsByFilterRequest
|
||||||
|
{
|
||||||
|
PaginationState pagination_state = 1;
|
||||||
|
google.protobuf.StringValue sort_by = 2;
|
||||||
|
GetAllProductsByFilterFilter filter = 3;
|
||||||
|
}
|
||||||
message GetAllProductsByFilterFilter
|
message GetAllProductsByFilterFilter
|
||||||
{
|
{
|
||||||
google.protobuf.Int64Value id = 1;
|
google.protobuf.Int64Value id = 1;
|
||||||
@@ -56,6 +62,11 @@ message GetAllProductsByFilterFilter
|
|||||||
google.protobuf.Int32Value discount = 7;
|
google.protobuf.Int32Value discount = 7;
|
||||||
google.protobuf.Int32Value rate = 8;
|
google.protobuf.Int32Value rate = 8;
|
||||||
}
|
}
|
||||||
|
message GetAllProductsByFilterResponse
|
||||||
|
{
|
||||||
|
MetaData meta_data = 1;
|
||||||
|
repeated GetAllProductsByFilterResponseModel models = 2;
|
||||||
|
}
|
||||||
message GetAllProductsByFilterResponseModel
|
message GetAllProductsByFilterResponseModel
|
||||||
{
|
{
|
||||||
int64 id = 1;
|
int64 id = 1;
|
||||||
|
|||||||
@@ -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);
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user