From 2e3c56bb21a3ba06b846492d47d1a8fc317de24a Mon Sep 17 00:00:00 2001 From: ilham Date: Thu, 23 Dec 2021 00:13:03 +0700 Subject: [PATCH] fix: get product for transaction --- src/product/product.service.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/product/product.service.ts b/src/product/product.service.ts index f98fdc4..fc72d7c 100644 --- a/src/product/product.service.ts +++ b/src/product/product.service.ts @@ -246,7 +246,12 @@ export class ProductService { 'product.currentPrice', 'product.priceHistory', 'current_price', - 'current_price.partner_id is null', + 'current_price.partner_id is NULL and current_price.end_date is NULL', + ) + .select(['product.id']) + .addSelect(['product.name', 'product.code', 'sub_categories.name']) + .addSelect( + '(current_price.price + current_price.mark_up_price) as price', ); if (subCategories != 'null' && subCategories) { @@ -256,9 +261,9 @@ export class ProductService { } const data = await baseQuery - .skip(page * (pageSize || 10)) - .take(pageSize || 10) - .getMany(); + .offset(page * 10) + .limit(10) + .getRawMany(); const totalData = await baseQuery.getCount();