From 284ae2416b51857470869e6533332cd2b8585ab6 Mon Sep 17 00:00:00 2001 From: mfadiln2018 Date: Wed, 11 May 2022 16:57:08 +0700 Subject: [PATCH] Feat add column admin_price at table product history price --- src/product/entities/product-history-price.entity.ts | 3 +++ src/product/product.service.ts | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/product/entities/product-history-price.entity.ts b/src/product/entities/product-history-price.entity.ts index 1653082..0de10e9 100644 --- a/src/product/entities/product-history-price.entity.ts +++ b/src/product/entities/product-history-price.entity.ts @@ -32,4 +32,7 @@ export class ProductHistoryPrice extends BaseModel { @Column('text') type: productType; + + @Column() + admin_price: number; } diff --git a/src/product/product.service.ts b/src/product/product.service.ts index 8220b67..5f55c63 100644 --- a/src/product/product.service.ts +++ b/src/product/product.service.ts @@ -182,6 +182,7 @@ export class ProductService { 'supplier.name', 'category.name', 'product.status', + 'current_price.admin_price as admin_price', ]) .addSelect('current_price.price') .addSelect( @@ -334,7 +335,12 @@ export class ProductService { }, ) .select(['product.id']) - .addSelect(['product.name', 'product.code', 'sub_categories.name']) + .addSelect([ + 'product.name', + 'product.code', + 'sub_categories.name', + 'current_price.admin_price as admin_price', + ]) .addSelect( '(current_price.price + current_price.mark_up_price) as price', );