@@ -1673,7 +1673,8 @@ export class ProductRepository extends BaseRepository<IProduct> {
|
||||
{
|
||||
$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],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user