From b955f89be02246c5e078ec28104c70204a8bd7bf Mon Sep 17 00:00:00 2001 From: morteza-mortezai Date: Sun, 26 Oct 2025 12:39:29 +0330 Subject: [PATCH 1/2] fix : bug create no color no size variant --- src/modules/product/providers/product.service.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/product/providers/product.service.ts b/src/modules/product/providers/product.service.ts index 051c02a..053d168 100644 --- a/src/modules/product/providers/product.service.ts +++ b/src/modules/product/providers/product.service.ts @@ -1614,8 +1614,9 @@ class ProductService { if (categoryTheme !== CategoryThemeEnum.No_color_No_sized) return true; const variantCount = product.variants.length; - if (variantCount && variantCount === 0) return true; - + console.log("variantCount", variantCount); + if (!variantCount) return true; + console.log("pro", product, categoryTheme); throw new BadRequestError(ProductMessage.ProductWithNoVariantCategoryTheme); } From 1e38c353f2ebdad2bd63f21e6db4870a5010bd86 Mon Sep 17 00:00:00 2001 From: morteza-mortezai Date: Sun, 26 Oct 2025 13:15:25 +0330 Subject: [PATCH 2/2] fix : in category page, send products that have at least on variant --- src/modules/product/Repository/product.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/product/Repository/product.ts b/src/modules/product/Repository/product.ts index 1d88f2b..a5c6e23 100644 --- a/src/modules/product/Repository/product.ts +++ b/src/modules/product/Repository/product.ts @@ -1673,7 +1673,8 @@ export class ProductRepository extends BaseRepository { { $match: { $expr: { - $or: [{ $gt: [{ $size: { $ifNull: ["$variants", []] } }, 0] }, { $eq: ["$category.theme", "noColor_noSize"] }], + // $or: [{ $gt: [{ $size: { $ifNull: ["$variants", []] } }, 0] }, { $eq: ["$category.theme", "noColor_noSize"] }], + $gt: [{ $size: { $ifNull: ["$variants", []] } }, 0], }, }, },