them valkue

This commit is contained in:
morteza-mortezai
2025-11-29 13:14:03 +03:30
parent 754496f259
commit 488807278e
3 changed files with 33 additions and 42 deletions
@@ -961,9 +961,7 @@ class ProductService {
async getProductDetails(productId: number) {
await this.validateProduct(productId);
const docs = await this.productRepo.getProductDetails(productId);
if ((!docs?.[0]?.variants || docs?.[0]?.variants.length === 0) && docs?.[0]?.category.theme !== "noColor_noSize") {
throw new BadRequestError(CommonMessage.NotEnoughVariant);
}
const product = ProductDTO.transformProduct(docs[0]);
const stats = await this.commentRepo.getProductStats(productId);
const categoryPath = await this.categoryRepo.getCategoryPath(product.category._id.toString());