Merge branch 'development' into 'devops-staging'
fix: get list by categories all where partner is null See merge request empatnusabangsa/ppob/ppob-backend!220
This commit is contained in:
commit
a3bd320237
|
@ -333,19 +333,19 @@ export class ProductService {
|
||||||
status: 'ACTIVE',
|
status: 'ACTIVE',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.where(
|
// .where(
|
||||||
`product.supplier_id = :supplier_id`,
|
// `product.supplier_id = :supplier_id`,
|
||||||
{
|
// {
|
||||||
supplier_id: supplier,
|
// supplier_id: supplier,
|
||||||
},
|
// },
|
||||||
)
|
// )
|
||||||
.where(
|
.where(
|
||||||
`history_status.partner_id is NULL`,
|
`history_status.partner_id is NULL`,
|
||||||
{
|
{
|
||||||
partner_id: null,
|
partner_id: null,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.where(
|
.andWhere(
|
||||||
'supplier.status = TRUE',
|
'supplier.status = TRUE',
|
||||||
{
|
{
|
||||||
status: true,
|
status: true,
|
||||||
|
@ -356,6 +356,7 @@ export class ProductService {
|
||||||
.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('product.supplier_id', 'supplier')
|
||||||
.addSelect('supplier.status', 'status')
|
.addSelect('supplier.status', 'status')
|
||||||
|
.addSelect('history_status.partner_id', 'partner')
|
||||||
.orderBy('price', 'ASC')
|
.orderBy('price', 'ASC')
|
||||||
.distinct();
|
.distinct();
|
||||||
|
|
||||||
|
@ -406,11 +407,16 @@ export class ProductService {
|
||||||
const baseQuery = await this.productRepository
|
const baseQuery = await this.productRepository
|
||||||
.createQueryBuilder('product')
|
.createQueryBuilder('product')
|
||||||
.leftJoin('product.sub_categories', 'sub_categories')
|
.leftJoin('product.sub_categories', 'sub_categories')
|
||||||
.leftJoinAndSelect(
|
.leftJoin('product.supplier', 'supplier')
|
||||||
'product.supplier',
|
// .leftJoinAndSelect(
|
||||||
'supplier',
|
// 'product.supplier',
|
||||||
'supplier.status = true',
|
// 'supplier',
|
||||||
)
|
// 'supplier.status = true',
|
||||||
|
// {
|
||||||
|
// status: true
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// )
|
||||||
.innerJoinAndMapOne(
|
.innerJoinAndMapOne(
|
||||||
'product.currentPrice',
|
'product.currentPrice',
|
||||||
'product.priceHistory',
|
'product.priceHistory',
|
||||||
|
@ -435,11 +441,15 @@ export class ProductService {
|
||||||
.where(`history_status.status = 'ACTIVE'`, {
|
.where(`history_status.status = 'ACTIVE'`, {
|
||||||
status: 'ACTIVE',
|
status: 'ACTIVE',
|
||||||
})
|
})
|
||||||
|
.andWhere('supplier.status = TRUE', {
|
||||||
|
status: true
|
||||||
|
})
|
||||||
.select(['product.id'])
|
.select(['product.id'])
|
||||||
.addSelect([
|
.addSelect([
|
||||||
'product.name',
|
'product.name',
|
||||||
'product.code',
|
'product.code',
|
||||||
'product.type',
|
'product.type',
|
||||||
|
'product.supplier_id',
|
||||||
'sub_categories.name',
|
'sub_categories.name',
|
||||||
'current_price.admin_price as admin_price',
|
'current_price.admin_price as admin_price',
|
||||||
'current_price.mark_up_price as markup_price',
|
'current_price.mark_up_price as markup_price',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user