pop theme
This commit is contained in:
@@ -82,13 +82,17 @@ class SaleFormatDTO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//#################################
|
//#################################
|
||||||
|
export class ThemeDTO {
|
||||||
|
@Expose()
|
||||||
|
title: string;
|
||||||
|
}
|
||||||
|
|
||||||
export class ThemeValueDTO {
|
export class ThemeValueDTO {
|
||||||
@Expose()
|
@Expose()
|
||||||
_id: string;
|
_id: string;
|
||||||
|
|
||||||
@Expose()
|
@Expose()
|
||||||
theme: string;
|
theme: ThemeDTO;
|
||||||
|
|
||||||
@Expose()
|
@Expose()
|
||||||
name?: string;
|
name?: string;
|
||||||
|
|||||||
@@ -86,15 +86,36 @@ export class ProductVariantRepository extends BaseRepository<IProductVariant> {
|
|||||||
{
|
{
|
||||||
$unwind: "$category",
|
$unwind: "$category",
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
$lookup: {
|
$lookup: {
|
||||||
from: "themeValues",
|
from: "themevalues",
|
||||||
localField: "themeValue",
|
localField: "themeValue",
|
||||||
foreignField: "_id",
|
foreignField: "_id",
|
||||||
as: "themeValue",
|
as: "themeValue",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
$unwind: {
|
||||||
|
path: "$themeValue",
|
||||||
|
preserveNullAndEmptyArrays: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$lookup: {
|
||||||
|
from: "themes",
|
||||||
|
localField: "themeValue.theme",
|
||||||
|
foreignField: "_id",
|
||||||
|
as: "theme_doc",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$addFields: {
|
||||||
|
"themeValue.theme": { $arrayElemAt: ["$theme_doc", 0] },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$project: { theme_doc: 0 }, // drop the temporary array
|
||||||
|
},
|
||||||
{
|
{
|
||||||
$lookup: {
|
$lookup: {
|
||||||
from: "shipments",
|
from: "shipments",
|
||||||
@@ -103,12 +124,7 @@ export class ProductVariantRepository extends BaseRepository<IProductVariant> {
|
|||||||
as: "shipmentMethod",
|
as: "shipmentMethod",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
$unwind: {
|
|
||||||
path: "$themeValue",
|
|
||||||
preserveNullAndEmptyArrays: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
$addFields: {
|
$addFields: {
|
||||||
|
|||||||
Reference in New Issue
Block a user