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:
		@@ -333,19 +333,19 @@ export class ProductService {
 | 
			
		||||
              status: 'ACTIVE',
 | 
			
		||||
            },
 | 
			
		||||
        )
 | 
			
		||||
      .where(
 | 
			
		||||
        `product.supplier_id = :supplier_id`,
 | 
			
		||||
        {
 | 
			
		||||
          supplier_id: supplier,
 | 
			
		||||
        },
 | 
			
		||||
      )
 | 
			
		||||
      // .where(
 | 
			
		||||
      //   `product.supplier_id = :supplier_id`,
 | 
			
		||||
      //   {
 | 
			
		||||
      //     supplier_id: supplier,
 | 
			
		||||
      //   },
 | 
			
		||||
      // )
 | 
			
		||||
        .where(
 | 
			
		||||
            `history_status.partner_id is NULL`,
 | 
			
		||||
            {
 | 
			
		||||
              partner_id: null,
 | 
			
		||||
            },
 | 
			
		||||
        )
 | 
			
		||||
        .where(
 | 
			
		||||
        .andWhere(
 | 
			
		||||
            'supplier.status = TRUE',
 | 
			
		||||
            {
 | 
			
		||||
              status: true,
 | 
			
		||||
@@ -356,6 +356,7 @@ export class ProductService {
 | 
			
		||||
      .addSelect('(current_price.price + current_price.mark_up_price) as price')
 | 
			
		||||
        .addSelect('product.supplier_id', 'supplier')
 | 
			
		||||
        .addSelect('supplier.status', 'status')
 | 
			
		||||
        .addSelect('history_status.partner_id', 'partner')
 | 
			
		||||
        .orderBy('price', 'ASC')
 | 
			
		||||
      .distinct();
 | 
			
		||||
 | 
			
		||||
@@ -406,11 +407,16 @@ export class ProductService {
 | 
			
		||||
    const baseQuery = await this.productRepository
 | 
			
		||||
      .createQueryBuilder('product')
 | 
			
		||||
      .leftJoin('product.sub_categories', 'sub_categories')
 | 
			
		||||
      .leftJoinAndSelect(
 | 
			
		||||
        'product.supplier',
 | 
			
		||||
        'supplier',
 | 
			
		||||
        'supplier.status = true',
 | 
			
		||||
      )
 | 
			
		||||
        .leftJoin('product.supplier', 'supplier')
 | 
			
		||||
        // .leftJoinAndSelect(
 | 
			
		||||
      //   'product.supplier',
 | 
			
		||||
      //   'supplier',
 | 
			
		||||
      //   'supplier.status = true',
 | 
			
		||||
      //     {
 | 
			
		||||
      //       status: true
 | 
			
		||||
      //     }
 | 
			
		||||
      //
 | 
			
		||||
      // )
 | 
			
		||||
      .innerJoinAndMapOne(
 | 
			
		||||
        'product.currentPrice',
 | 
			
		||||
        'product.priceHistory',
 | 
			
		||||
@@ -435,11 +441,15 @@ export class ProductService {
 | 
			
		||||
      .where(`history_status.status = 'ACTIVE'`, {
 | 
			
		||||
        status: 'ACTIVE',
 | 
			
		||||
      })
 | 
			
		||||
        .andWhere('supplier.status = TRUE', {
 | 
			
		||||
          status: true
 | 
			
		||||
        })
 | 
			
		||||
      .select(['product.id'])
 | 
			
		||||
      .addSelect([
 | 
			
		||||
        'product.name',
 | 
			
		||||
        'product.code',
 | 
			
		||||
        'product.type',
 | 
			
		||||
        'product.supplier_id',
 | 
			
		||||
        'sub_categories.name',
 | 
			
		||||
        'current_price.admin_price as admin_price',
 | 
			
		||||
        'current_price.mark_up_price as markup_price',
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user