Merge branch 'development' into 'devops-staging'
Development See merge request empatnusabangsa/ppob/ppob-backend!142
This commit is contained in:
		@@ -248,33 +248,33 @@ 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(
 | 
			
		||||
        '(current_price.price + current_price.mark_up_price) as price',
 | 
			
		||||
      );
 | 
			
		||||
      .addSelect('(current_price.price + current_price.mark_up_price) as price')
 | 
			
		||||
      .orderBy('price', 'ASC');
 | 
			
		||||
 | 
			
		||||
    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