Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bb20ad2c4e | |||
| 246d893b62 |
+4
@@ -8,6 +8,10 @@ public class GetDiscountProductsQuery : IRequest<GetDiscountProductsResponseDto>
|
|||||||
public PaginationState? PaginationQuery { get; set; }
|
public PaginationState? PaginationQuery { get; set; }
|
||||||
public long? CategoryId { get; set; }
|
public long? CategoryId { get; set; }
|
||||||
public string? SearchTerm { get; set; }
|
public string? SearchTerm { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// true = فقط موجود (RemainingCount > 0)، false = فقط ناموجود
|
||||||
|
/// </summary>
|
||||||
|
public bool? InStock { get; set; }
|
||||||
public bool? IsActive { get; set; }
|
public bool? IsActive { get; set; }
|
||||||
public int? MinPrice { get; set; }
|
public int? MinPrice { get; set; }
|
||||||
public int? MaxPrice { get; set; }
|
public int? MaxPrice { get; set; }
|
||||||
|
|||||||
+5
@@ -42,6 +42,11 @@ public class GetDiscountProductsQueryHandler : IRequestHandler<GetDiscountProduc
|
|||||||
query = query.Where(p => p.IsActive == request.IsActive.Value);
|
query = query.Where(p => p.IsActive == request.IsActive.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (request.InStock == true)
|
||||||
|
query = query.Where(p => p.RemainingCount > 0);
|
||||||
|
else if (request.InStock == false)
|
||||||
|
query = query.Where(p => p.RemainingCount <= 0);
|
||||||
|
|
||||||
if (request.MinPrice.HasValue)
|
if (request.MinPrice.HasValue)
|
||||||
{
|
{
|
||||||
query = query.Where(p => p.Price >= request.MinPrice.Value);
|
query = query.Where(p => p.Price >= request.MinPrice.Value);
|
||||||
|
|||||||
+4
@@ -21,6 +21,10 @@ public class GetCustomerProductsByFilterQuery : IRequest<GetCustomerProductsByFi
|
|||||||
public int? SaleCount { get; set; }
|
public int? SaleCount { get; set; }
|
||||||
public int? ViewCount { get; set; }
|
public int? ViewCount { get; set; }
|
||||||
public int? RemainingCount { get; set; }
|
public int? RemainingCount { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// true = فقط موجود (RemainingCount > 0)، false = فقط ناموجود
|
||||||
|
/// </summary>
|
||||||
|
public bool? InStock { get; set; }
|
||||||
public bool? IsActive { get; set; }
|
public bool? IsActive { get; set; }
|
||||||
public List<long>? CategoryIds { get; set; }
|
public List<long>? CategoryIds { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
+5
@@ -56,6 +56,11 @@ public class GetCustomerProductsByFilterQueryHandler : IRequestHandler<GetCustom
|
|||||||
if (request.RemainingCount.HasValue)
|
if (request.RemainingCount.HasValue)
|
||||||
query = query.Where(x => x.RemainingCount == request.RemainingCount.Value);
|
query = query.Where(x => x.RemainingCount == request.RemainingCount.Value);
|
||||||
|
|
||||||
|
if (request.InStock == true)
|
||||||
|
query = query.Where(x => x.RemainingCount > 0);
|
||||||
|
else if (request.InStock == false)
|
||||||
|
query = query.Where(x => x.RemainingCount <= 0);
|
||||||
|
|
||||||
if (request.CategoryIds != null && request.CategoryIds.Any())
|
if (request.CategoryIds != null && request.CategoryIds.Any())
|
||||||
query = query.Where(x => x.ProductCategories.Any(pc => request.CategoryIds.Contains(pc.CategoryId)));
|
query = query.Where(x => x.ProductCategories.Any(pc => request.CategoryIds.Contains(pc.CategoryId)));
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<Version>0.0.203</Version>
|
<Version>0.0.204</Version>
|
||||||
<DebugType>None</DebugType>
|
<DebugType>None</DebugType>
|
||||||
<DebugSymbols>False</DebugSymbols>
|
<DebugSymbols>False</DebugSymbols>
|
||||||
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
|
||||||
|
|||||||
@@ -229,6 +229,7 @@ message GetAllProductsByFilterFilter
|
|||||||
google.protobuf.Int32Value remaining_count = 13;
|
google.protobuf.Int32Value remaining_count = 13;
|
||||||
google.protobuf.Int64Value category_id = 14;
|
google.protobuf.Int64Value category_id = 14;
|
||||||
google.protobuf.BoolValue is_active = 15;
|
google.protobuf.BoolValue is_active = 15;
|
||||||
|
google.protobuf.BoolValue in_stock = 16;
|
||||||
}
|
}
|
||||||
message GetAllProductsByFilterResponse
|
message GetAllProductsByFilterResponse
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ public class DiscountProductProfile : IRegister
|
|||||||
src => src.CategoryId != null ? src.CategoryId.Value : (long?)null)
|
src => src.CategoryId != null ? src.CategoryId.Value : (long?)null)
|
||||||
.Map(dest => dest.IsActive,
|
.Map(dest => dest.IsActive,
|
||||||
src => src.IsActive != null ? src.IsActive.Value : (bool?)null)
|
src => src.IsActive != null ? src.IsActive.Value : (bool?)null)
|
||||||
|
.Map(dest => dest.InStock,
|
||||||
|
src => src.InStock != null ? src.InStock.Value : (bool?)null)
|
||||||
.Map(dest => dest.MinPrice,
|
.Map(dest => dest.MinPrice,
|
||||||
src => src.MinPrice != null ? (int?)src.MinPrice.Value : null)
|
src => src.MinPrice != null ? (int?)src.MinPrice.Value : null)
|
||||||
.Map(dest => dest.MaxPrice,
|
.Map(dest => dest.MaxPrice,
|
||||||
|
|||||||
@@ -175,6 +175,7 @@ public class ProductsService : ProductsContract.ProductsContractBase
|
|||||||
SaleCount = request.Filter?.SaleCount,
|
SaleCount = request.Filter?.SaleCount,
|
||||||
ViewCount = request.Filter?.ViewCount,
|
ViewCount = request.Filter?.ViewCount,
|
||||||
RemainingCount = request.Filter?.RemainingCount,
|
RemainingCount = request.Filter?.RemainingCount,
|
||||||
|
InStock = request.Filter?.InStock,
|
||||||
CategoryIds = request.Filter?.CategoryId.HasValue == true
|
CategoryIds = request.Filter?.CategoryId.HasValue == true
|
||||||
? new List<long> { request.Filter.CategoryId.Value }
|
? new List<long> { request.Filter.CategoryId.Value }
|
||||||
: new List<long>(),
|
: new List<long>(),
|
||||||
@@ -567,6 +568,7 @@ public class ProductsService : ProductsContract.ProductsContractBase
|
|||||||
SaleCount = request.Filter?.SaleCount,
|
SaleCount = request.Filter?.SaleCount,
|
||||||
ViewCount = request.Filter?.ViewCount,
|
ViewCount = request.Filter?.ViewCount,
|
||||||
RemainingCount = request.Filter?.RemainingCount,
|
RemainingCount = request.Filter?.RemainingCount,
|
||||||
|
InStock = request.Filter?.InStock,
|
||||||
CategoryIds = request.Filter?.CategoryId != null ? new List<long> { request.Filter.CategoryId.Value } : null
|
CategoryIds = request.Filter?.CategoryId != null ? new List<long> { request.Filter.CategoryId.Value } : null
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user