@@ -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 {
|
export class ThemeValueDTO {
|
||||||
@Expose()
|
@Expose()
|
||||||
_id: string;
|
_id: string;
|
||||||
@@ -331,10 +293,6 @@ export class ProductVariantDTO {
|
|||||||
@Type(() => ThemeValueDTO)
|
@Type(() => ThemeValueDTO)
|
||||||
themeValue?: ThemeValueDTO;
|
themeValue?: ThemeValueDTO;
|
||||||
|
|
||||||
@Expose()
|
|
||||||
@Type(() => VariantProductDTO)
|
|
||||||
product?: VariantProductDTO;
|
|
||||||
|
|
||||||
public static transformProduct(data: IProductVariant): ProductVariantDTO {
|
public static transformProduct(data: IProductVariant): ProductVariantDTO {
|
||||||
const productVariantDTO = plainToInstance(ProductVariantDTO, data, {
|
const productVariantDTO = plainToInstance(ProductVariantDTO, data, {
|
||||||
excludeExtraneousValues: true,
|
excludeExtraneousValues: true,
|
||||||
|
|||||||
@@ -110,24 +110,6 @@ export class ProductVariantRepository extends BaseRepository<IProductVariant> {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
|
||||||
$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: {
|
$addFields: {
|
||||||
product_id: "$product._id",
|
product_id: "$product._id",
|
||||||
@@ -138,7 +120,7 @@ export class ProductVariantRepository extends BaseRepository<IProductVariant> {
|
|||||||
model: "$product.model",
|
model: "$product.model",
|
||||||
category_theme: "$category.theme",
|
category_theme: "$category.theme",
|
||||||
category_title_fa: "$category.title_fa",
|
category_title_fa: "$category.title_fa",
|
||||||
coverImage: "$product.images.cover",
|
coverImage: "$product.imagesUrl.cover",
|
||||||
is_variant_active: {
|
is_variant_active: {
|
||||||
$cond: {
|
$cond: {
|
||||||
if: { $eq: ["$market_status", ProductMarketStatus.Marketable] },
|
if: { $eq: ["$market_status", ProductMarketStatus.Marketable] },
|
||||||
@@ -165,6 +147,7 @@ export class ProductVariantRepository extends BaseRepository<IProductVariant> {
|
|||||||
{
|
{
|
||||||
$project: {
|
$project: {
|
||||||
category: 0,
|
category: 0,
|
||||||
|
product: 0,
|
||||||
shop: 0,
|
shop: 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user