Merge branch 'kub-stage' into production
Build and Deploy to Production / build-and-deploy (push) Has been cancelled
Build and Deploy to Production / build-and-deploy (push) Has been cancelled
This commit is contained in:
+4
@@ -8,6 +8,10 @@ public class GetDiscountProductsQuery : IRequest<GetDiscountProductsResponseDto>
|
||||
public PaginationState? PaginationQuery { get; set; }
|
||||
public long? CategoryId { get; set; }
|
||||
public string? SearchTerm { get; set; }
|
||||
/// <summary>
|
||||
/// true = فقط موجود (RemainingCount > 0)، false = فقط ناموجود
|
||||
/// </summary>
|
||||
public bool? InStock { get; set; }
|
||||
public bool? IsActive { get; set; }
|
||||
public int? MinPrice { 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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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? ViewCount { get; set; }
|
||||
public int? RemainingCount { get; set; }
|
||||
/// <summary>
|
||||
/// true = فقط موجود (RemainingCount > 0)، false = فقط ناموجود
|
||||
/// </summary>
|
||||
public bool? InStock { get; set; }
|
||||
public bool? IsActive { get; set; }
|
||||
public List<long>? CategoryIds { get; set; }
|
||||
}
|
||||
|
||||
+5
@@ -56,6 +56,11 @@ public class GetCustomerProductsByFilterQueryHandler : IRequestHandler<GetCustom
|
||||
if (request.RemainingCount.HasValue)
|
||||
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())
|
||||
query = query.Where(x => x.ProductCategories.Any(pc => request.CategoryIds.Contains(pc.CategoryId)));
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>0.0.203</Version>
|
||||
<Version>0.0.204</Version>
|
||||
<DebugType>None</DebugType>
|
||||
<DebugSymbols>False</DebugSymbols>
|
||||
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
|
||||
|
||||
@@ -229,6 +229,7 @@ message GetAllProductsByFilterFilter
|
||||
google.protobuf.Int32Value remaining_count = 13;
|
||||
google.protobuf.Int64Value category_id = 14;
|
||||
google.protobuf.BoolValue is_active = 15;
|
||||
google.protobuf.BoolValue in_stock = 16;
|
||||
}
|
||||
message GetAllProductsByFilterResponse
|
||||
{
|
||||
|
||||
@@ -19,6 +19,8 @@ public class DiscountProductProfile : IRegister
|
||||
src => src.CategoryId != null ? src.CategoryId.Value : (long?)null)
|
||||
.Map(dest => dest.IsActive,
|
||||
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,
|
||||
src => src.MinPrice != null ? (int?)src.MinPrice.Value : null)
|
||||
.Map(dest => dest.MaxPrice,
|
||||
|
||||
@@ -175,6 +175,7 @@ public class ProductsService : ProductsContract.ProductsContractBase
|
||||
SaleCount = request.Filter?.SaleCount,
|
||||
ViewCount = request.Filter?.ViewCount,
|
||||
RemainingCount = request.Filter?.RemainingCount,
|
||||
InStock = request.Filter?.InStock,
|
||||
CategoryIds = request.Filter?.CategoryId.HasValue == true
|
||||
? new List<long> { request.Filter.CategoryId.Value }
|
||||
: new List<long>(),
|
||||
@@ -567,6 +568,7 @@ public class ProductsService : ProductsContract.ProductsContractBase
|
||||
SaleCount = request.Filter?.SaleCount,
|
||||
ViewCount = request.Filter?.ViewCount,
|
||||
RemainingCount = request.Filter?.RemainingCount,
|
||||
InStock = request.Filter?.InStock,
|
||||
CategoryIds = request.Filter?.CategoryId != null ? new List<long> { request.Filter.CategoryId.Value } : null
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user