From a979d77ca5220e5491011c2ef995a9b7618c58b0 Mon Sep 17 00:00:00 2001 From: morteza-mortezai Date: Sat, 13 Dec 2025 15:55:25 +0330 Subject: [PATCH] Revert "pop product" This reverts commit 64eeb7d45b2e4cbfaf46f0cd3edcfe6b20ef0f51. --- src/modules/product/DTO/product.dto.ts | 42 ------------------- .../product/Repository/productVarinat.ts | 21 +--------- 2 files changed, 2 insertions(+), 61 deletions(-) diff --git a/src/modules/product/DTO/product.dto.ts b/src/modules/product/DTO/product.dto.ts index 4cc116a..4645f23 100644 --- a/src/modules/product/DTO/product.dto.ts +++ b/src/modules/product/DTO/product.dto.ts @@ -83,44 +83,6 @@ class SaleFormatDTO { //################################# -class VariantProductCategoryDTO { - @Expose() - _id: string; - - @Expose() - title_fa: string; - - @Expose() - theme: string; -} - -class VariantProductDTO { - @Expose() - _id: number; - - @Expose() - title_fa: string; - - @Expose() - title_en: string; - - @Expose() - status: string; - - @Expose() - model: string; - - @Expose() - @Type(() => ImagesUrlDTO) - images: ImagesUrlDTO; - - @Expose() - @Type(() => VariantProductCategoryDTO) - category: VariantProductCategoryDTO; -} - -//################################# - export class ThemeValueDTO { @Expose() _id: string; @@ -331,10 +293,6 @@ export class ProductVariantDTO { @Type(() => ThemeValueDTO) themeValue?: ThemeValueDTO; - @Expose() - @Type(() => VariantProductDTO) - product?: VariantProductDTO; - public static transformProduct(data: IProductVariant): ProductVariantDTO { const productVariantDTO = plainToInstance(ProductVariantDTO, data, { excludeExtraneousValues: true, diff --git a/src/modules/product/Repository/productVarinat.ts b/src/modules/product/Repository/productVarinat.ts index 34c542c..27a3969 100644 --- a/src/modules/product/Repository/productVarinat.ts +++ b/src/modules/product/Repository/productVarinat.ts @@ -110,24 +110,6 @@ export class ProductVariantRepository extends BaseRepository { }, }, - { - $addFields: { - product: { - _id: "$product._id", - title_fa: "$product.title_fa", - title_en: "$product.title_en", - status: "$product.status", - model: "$product.model", - images: "$product.imagesUrl", - category: { - _id: "$category._id", - title_fa: "$category.title_fa", - theme: "$category.theme", - }, - }, - }, - }, - { $addFields: { product_id: "$product._id", @@ -138,7 +120,7 @@ export class ProductVariantRepository extends BaseRepository { model: "$product.model", category_theme: "$category.theme", category_title_fa: "$category.title_fa", - coverImage: "$product.images.cover", + coverImage: "$product.imagesUrl.cover", is_variant_active: { $cond: { if: { $eq: ["$market_status", ProductMarketStatus.Marketable] }, @@ -165,6 +147,7 @@ export class ProductVariantRepository extends BaseRepository { { $project: { category: 0, + product: 0, shop: 0, }, },