Merge branch 'development' into 'devops-staging'

fix: get list by categories all where supplier status is true

See merge request empatnusabangsa/ppob/ppob-backend!219
This commit is contained in:
muhammad fadil 2022-09-07 10:52:31 +00:00
commit b6a743d006

View File

@ -314,8 +314,9 @@ export class ProductService {
const baseQuery = this.productRepository
.createQueryBuilder('product')
.leftJoin('product.sub_categories', 'sub_categories')
.leftJoin('product.supplier', 'supplier')
// .leftJoin('product.statusHistory', 'status_history')
// .leftJoin('product.statusHistory', 'status_history')
.leftJoinAndMapOne(
'product.currentPrice',
@ -344,10 +345,18 @@ export class ProductService {
partner_id: null,
},
)
.where(
'supplier.status = TRUE',
{
status: true,
},
)
.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')
.addSelect('product.supplier_id', 'supplier')
.addSelect('supplier.status', 'status')
.orderBy('price', 'ASC')
.distinct();
if (subCategories != 'null' && subCategories) {