fix: product in partner
This commit is contained in:
parent
137ca8e6f3
commit
819c59f28f
|
@ -172,7 +172,7 @@ export class ProductService {
|
||||||
'product.currentPrice',
|
'product.currentPrice',
|
||||||
'product.priceHistory',
|
'product.priceHistory',
|
||||||
'current_price',
|
'current_price',
|
||||||
'current_price.partner_id is null and current_price.end_date is NULL',
|
'current_price.end_date is NULL',
|
||||||
)
|
)
|
||||||
.select(['product.id'])
|
.select(['product.id'])
|
||||||
.addSelect([
|
.addSelect([
|
||||||
|
@ -297,7 +297,6 @@ export class ProductService {
|
||||||
username: string,
|
username: string,
|
||||||
) {
|
) {
|
||||||
const user = await this.usersService.findOneByUsername(username);
|
const user = await this.usersService.findOneByUsername(username);
|
||||||
const supplier = await this.supplierService.findByActive();
|
|
||||||
|
|
||||||
if (user.partner === null) {
|
if (user.partner === null) {
|
||||||
throw new HttpException(
|
throw new HttpException(
|
||||||
|
@ -312,12 +311,12 @@ export class ProductService {
|
||||||
const baseQuery = this.productRepository
|
const baseQuery = this.productRepository
|
||||||
.createQueryBuilder('product')
|
.createQueryBuilder('product')
|
||||||
.leftJoin('product.sub_categories', 'sub_categories')
|
.leftJoin('product.sub_categories', 'sub_categories')
|
||||||
.where(
|
.leftJoinAndSelect(
|
||||||
`product.supplier_id = :supplier_id and product.status = 'ACTIVE'`,
|
'product.supplier',
|
||||||
{
|
'supplier',
|
||||||
supplier_id: supplier.id,
|
'supplier.status = true',
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
.where(`product.status = 'ACTIVE'`)
|
||||||
.innerJoinAndMapOne(
|
.innerJoinAndMapOne(
|
||||||
'product.currentPrice',
|
'product.currentPrice',
|
||||||
'product.priceHistory',
|
'product.priceHistory',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user