Add CategoryId filter to product query and proto

This commit is contained in:
masoodafar-web
2025-11-28 11:00:36 +03:30
parent ce2bf3f1f0
commit a3c7033d95
4 changed files with 5 additions and 1 deletions

View File

@@ -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; }
//

View File

@@ -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)

View File

@@ -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>

View File

@@ -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
{