diff --git a/src/product/product.service.ts b/src/product/product.service.ts index 1afb8a0..5cb5745 100644 --- a/src/product/product.service.ts +++ b/src/product/product.service.ts @@ -172,7 +172,7 @@ export class ProductService { 'product.currentPrice', 'product.priceHistory', 'current_price', - 'current_price.partner_id is null and current_price.end_date is NULL', + 'current_price.end_date is NULL', ) .select(['product.id']) .addSelect([ @@ -297,7 +297,6 @@ export class ProductService { username: string, ) { const user = await this.usersService.findOneByUsername(username); - const supplier = await this.supplierService.findByActive(); if (user.partner === null) { throw new HttpException( @@ -312,12 +311,12 @@ export class ProductService { const baseQuery = this.productRepository .createQueryBuilder('product') .leftJoin('product.sub_categories', 'sub_categories') - .where( - `product.supplier_id = :supplier_id and product.status = 'ACTIVE'`, - { - supplier_id: supplier.id, - }, + .leftJoinAndSelect( + 'product.supplier', + 'supplier', + 'supplier.status = true', ) + .where(`product.status = 'ACTIVE'`) .innerJoinAndMapOne( 'product.currentPrice', 'product.priceHistory',