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:20 +00:00
commit e23a22a8e7

View File

@ -314,6 +314,7 @@ export class ProductService {
const baseQuery = this.productRepository const baseQuery = this.productRepository
.createQueryBuilder('product') .createQueryBuilder('product')
.leftJoin('product.sub_categories', 'sub_categories') .leftJoin('product.sub_categories', 'sub_categories')
.leftJoin('product.supplier', 'supplier')
// .leftJoin('product.statusHistory', 'status_history') // .leftJoin('product.statusHistory', 'status_history')
@ -344,9 +345,17 @@ export class ProductService {
partner_id: null, partner_id: null,
}, },
) )
.where(
'supplier.status = TRUE',
{
status: true,
},
)
.select(['product.id']) .select(['product.id'])
.addSelect(['product.name', 'product.code', 'sub_categories.name']) .addSelect(['product.name', 'product.code', 'sub_categories.name'])
.addSelect('(current_price.price + current_price.mark_up_price) as price') .addSelect('(current_price.price + current_price.mark_up_price) as price')
.addSelect('product.supplier_id', 'supplier')
.addSelect('supplier.status', 'status')
.orderBy('price', 'ASC') .orderBy('price', 'ASC')
.distinct(); .distinct();