fix: get product for transaction

This commit is contained in:
ilham 2021-12-23 00:13:03 +07:00
parent 00bac582a6
commit 2e3c56bb21

View File

@ -246,7 +246,12 @@ export class ProductService {
'product.currentPrice', 'product.currentPrice',
'product.priceHistory', 'product.priceHistory',
'current_price', '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) { if (subCategories != 'null' && subCategories) {
@ -256,9 +261,9 @@ export class ProductService {
} }
const data = await baseQuery const data = await baseQuery
.skip(page * (pageSize || 10)) .offset(page * 10)
.take(pageSize || 10) .limit(10)
.getMany(); .getRawMany();
const totalData = await baseQuery.getCount(); const totalData = await baseQuery.getCount();