fix: unselect product that not active
This commit is contained in:
parent
691035c394
commit
bee8557055
|
@ -57,11 +57,12 @@ export class ProductService {
|
|||
if (supplier == 'null' || !supplier) {
|
||||
supplier = (await this.supplierService.findByActive()).id;
|
||||
}
|
||||
|
||||
const baseQuery = this.productRepository
|
||||
.createQueryBuilder('product')
|
||||
.leftJoin('product.sub_categories', 'sub_categories')
|
||||
.leftJoin('sub_categories.category', 'category')
|
||||
.where('product.supplier_id = :supplier_id', {
|
||||
.where(`product.supplier_id = :supplier_id`, {
|
||||
supplier_id: supplier,
|
||||
})
|
||||
.leftJoinAndMapOne(
|
||||
|
@ -131,12 +132,16 @@ export class ProductService {
|
|||
if (supplier != 'null' && !supplier) {
|
||||
supplier = (await this.supplierService.findByActive()).id;
|
||||
}
|
||||
|
||||
const baseQuery = this.productRepository
|
||||
.createQueryBuilder('product')
|
||||
.leftJoin('product.sub_categories', 'sub_categories')
|
||||
.where('product.supplier_id = :supplier_id', {
|
||||
supplier_id: supplier,
|
||||
})
|
||||
.where(
|
||||
`product.supplier_id = :supplier_id and product.status = 'ACTIVE'`,
|
||||
{
|
||||
supplier_id: supplier,
|
||||
},
|
||||
)
|
||||
.leftJoinAndMapOne(
|
||||
'product.currentPrice',
|
||||
'product.priceHistory',
|
||||
|
@ -176,7 +181,7 @@ export class ProductService {
|
|||
.createQueryBuilder('product')
|
||||
.leftJoin('product.sub_categories', 'sub_categories')
|
||||
.where(
|
||||
'sub_categories.category_id = :id and product.supplier_id = :supplier_id',
|
||||
`sub_categories.category_id = :id and product.supplier_id = :supplier_id and product.status = 'ACTIVE'`,
|
||||
{
|
||||
id: categories,
|
||||
supplier_id: supplier.id,
|
||||
|
|
Loading…
Reference in New Issue
Block a user