feat: select all field for the brand

This commit is contained in:
mahyargdz
2025-09-20 09:33:42 +03:30
parent 23a51aceb3
commit 3d1aa01f2e
3 changed files with 11 additions and 16 deletions
+6 -6
View File
@@ -2471,11 +2471,11 @@ export class ProductRepository extends BaseRepository<IProduct> {
"variants.market_status": ProductMarketStatus.Marketable,
},
},
{
$match: {
variants: { $gt: [{ $size: "$variants" }, 0] }, // Ensure variants array has elements
},
},
// {
// $match: {
// variants: { $gt: [{ $size: "$variants" }, 0] }, // Ensure variants array has elements
// },
// },
{
$lookup: {
from: "categories",
@@ -2613,7 +2613,7 @@ export class ProductRepository extends BaseRepository<IProduct> {
docs: docs[0]?.data || [],
};
}
//**************************************************************
async getProductSpecification(productIds: string[] | string) {
const matchQuery: { [k: string]: unknown } = {
deleted: false,
@@ -1012,22 +1012,17 @@ class ProductService {
//**************************************************************
//**************************************************************
async searchForCompareProductsS(queries: CompareSearchQueries) {
const product = await this.validateProduct(+queries.productId);
const product = await this.validateProduct(queries.productId);
const { docs, count } = await this.productRepo.getProductsForCompareSearch(product.category.toString(), queries);
const products = docs.map((doc: IProduct) => ProductDTO.transformProduct(doc));
return {
count,
products,
};
return { count, products };
}
//**************************************************************
//**************************************************************
async compareProducts(productIds: string[] | string) {
const docs = await this.productRepo.getProductSpecification(productIds);
const products = docs.map((doc: IProduct) => ProductDTO.transformProduct(doc));
return {
products,
};
return { products };
}
//###############################################################