Add CategoryId filter to product query and proto
This commit is contained in:
@@ -26,6 +26,8 @@ public record GetAllProductsByFilterQuery : IRequest<GetAllProductsByFilterRespo
|
||||
public int? Discount { get; set; }
|
||||
//
|
||||
public int? Rate { get; set; }
|
||||
//
|
||||
public long? CategoryId { get; set; }
|
||||
//
|
||||
public string? ImagePath { get; set; }
|
||||
//
|
||||
|
||||
@@ -25,6 +25,7 @@ public class GetAllProductsByFilterQueryHandler : IRequestHandler<GetAllProducts
|
||||
.Where(x => request.Filter.Price == null || x.Price == request.Filter.Price)
|
||||
.Where(x => request.Filter.Discount == null || x.Discount == request.Filter.Discount)
|
||||
.Where(x => request.Filter.Rate == null || x.Rate == request.Filter.Rate)
|
||||
.Where(x => request.Filter.CategoryId == null || x.PruductCategorys.Any(pc => pc.CategoryId == request.Filter.CategoryId))
|
||||
.Where(x => request.Filter.ImagePath == null || x.ImagePath.Contains(request.Filter.ImagePath))
|
||||
.Where(x => request.Filter.ThumbnailPath == null || x.ThumbnailPath.Contains(request.Filter.ThumbnailPath))
|
||||
.Where(x => request.Filter.SaleCount == null || x.SaleCount == request.Filter.SaleCount)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>0.0.137</Version>
|
||||
<Version>0.0.138</Version>
|
||||
<DebugType>None</DebugType>
|
||||
<DebugSymbols>False</DebugSymbols>
|
||||
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
|
||||
|
||||
@@ -130,6 +130,7 @@ message GetAllProductsByFilterFilter
|
||||
google.protobuf.Int32Value sale_count = 11;
|
||||
google.protobuf.Int32Value view_count = 12;
|
||||
google.protobuf.Int32Value remaining_count = 13;
|
||||
google.protobuf.Int64Value category_id = 14;
|
||||
}
|
||||
message GetAllProductsByFilterResponse
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user