From ce99cf53274841182472b2e89229466b514c7e15 Mon Sep 17 00:00:00 2001 From: Fadli Date: Tue, 30 Aug 2022 11:05:39 +0700 Subject: [PATCH] - change status to product history status and only 1 value get from table product history status if value is same --- src/product/product.service.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/product/product.service.ts b/src/product/product.service.ts index eafd101..76f1494 100644 --- a/src/product/product.service.ts +++ b/src/product/product.service.ts @@ -215,7 +215,8 @@ export class ProductService { .addSelect( '(current_price.price + current_price.mark_up_price) as mark_up_price', ) - .orderBy('product.code'); + .orderBy('product.code') + .distinct(); if (subCategories && filterSubCategories.length > 0) { baseQuery.where('product.sub_categories_id IN (:...subCategoryId)', { @@ -299,7 +300,8 @@ export class ProductService { .select(['product.id']) .addSelect(['product.name', 'product.code', 'sub_categories.name']) .addSelect('(current_price.price + current_price.mark_up_price) as price') - .orderBy('price', 'ASC'); + .orderBy('price', 'ASC') + .distinct() if (subCategories != 'null' && subCategories) { baseQuery.andWhere('product.sub_categories_id = :id', {