Merge branch 'development' into 'devops-production'
fix: product See merge request empatnusabangsa/ppob/ppob-backend!139
This commit is contained in:
		| @@ -248,18 +248,19 @@ 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, | ||||
|         }, | ||||
|       ) | ||||
|  | ||||
|       .leftJoinAndMapOne( | ||||
|         'product.currentPrice', | ||||
|         'product.priceHistory', | ||||
|         'current_price', | ||||
|         'current_price.partner_id is NULL and current_price.end_date is NULL', | ||||
|       ) | ||||
|       .where( | ||||
|         `product.supplier_id = :supplier_id and product.status = 'ACTIVE'`, | ||||
|         { | ||||
|           supplier_id: supplier, | ||||
|         }, | ||||
|       ) | ||||
|       .select(['product.id']) | ||||
|       .addSelect(['product.name', 'product.code', 'sub_categories.name']) | ||||
|       .addSelect( | ||||
| @@ -267,14 +268,14 @@ export class ProductService { | ||||
|       ); | ||||
|  | ||||
|     if (subCategories != 'null' && subCategories) { | ||||
|       baseQuery.where('product.sub_categories_id = :id', { | ||||
|       baseQuery.andWhere('product.sub_categories_id = :id', { | ||||
|         id: subCategories, | ||||
|       }); | ||||
|     } | ||||
|  | ||||
|     const data = await baseQuery | ||||
|       .offset(page * 10) | ||||
|       .limit(10) | ||||
|       .offset(page * 1000) | ||||
|       .limit(1000) | ||||
|       .getRawMany(); | ||||
|  | ||||
|     const totalData = await baseQuery.getCount(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user