fix: get product
This commit is contained in:
parent
ba417b643e
commit
8df907287a
|
@ -15,6 +15,7 @@ import { productType } from '../helper/enum-list';
|
||||||
import { UpdatePriceProductDto } from './dto/product/update-price-product.dto';
|
import { UpdatePriceProductDto } from './dto/product/update-price-product.dto';
|
||||||
import { UsersService } from '../users/users.service';
|
import { UsersService } from '../users/users.service';
|
||||||
import { SupplierService } from '../users/supplier/supplier.service';
|
import { SupplierService } from '../users/supplier/supplier.service';
|
||||||
|
import { type } from 'os';
|
||||||
|
|
||||||
export class ProductService {
|
export class ProductService {
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -96,7 +97,7 @@ export class ProductService {
|
||||||
|
|
||||||
async findAllBySubCategories(page, subCategories, supplier) {
|
async findAllBySubCategories(page, subCategories, supplier) {
|
||||||
if (supplier != 'null' && !supplier) {
|
if (supplier != 'null' && !supplier) {
|
||||||
supplier = await this.supplierService.findByActive();
|
supplier = (await this.supplierService.findByActive()).id;
|
||||||
}
|
}
|
||||||
const baseQuery = this.productRepository
|
const baseQuery = this.productRepository
|
||||||
.createQueryBuilder('product')
|
.createQueryBuilder('product')
|
||||||
|
@ -111,7 +112,8 @@ export class ProductService {
|
||||||
'current_price.partner_id is null',
|
'current_price.partner_id is null',
|
||||||
);
|
);
|
||||||
|
|
||||||
if (subCategories != 'null' && !subCategories) {
|
if (subCategories != 'null' && subCategories) {
|
||||||
|
console.log(!subCategories,"testingan")
|
||||||
baseQuery.where('product.sub_categories_id = :id', {
|
baseQuery.where('product.sub_categories_id = :id', {
|
||||||
id: subCategories,
|
id: subCategories,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user