|
|
@@ -1,7 +1,6 @@
|
|
|
import { Client } from '@elastic/elasticsearch';
|
|
|
import { Controller, Inject, OnModuleDestroy, OnModuleInit } from '@nestjs/common';
|
|
|
import { MessagePattern } from '@nestjs/microservices';
|
|
|
-import { InjectConnection } from '@nestjs/typeorm';
|
|
|
import { unique } from '@vendure/common/lib/unique';
|
|
|
import {
|
|
|
Asset,
|
|
|
@@ -14,10 +13,11 @@ import {
|
|
|
ProductVariant,
|
|
|
ProductVariantService,
|
|
|
RequestContext,
|
|
|
+ TransactionalConnection,
|
|
|
translateDeep,
|
|
|
} from '@vendure/core';
|
|
|
import { Observable } from 'rxjs';
|
|
|
-import { Connection, SelectQueryBuilder } from 'typeorm';
|
|
|
+import { SelectQueryBuilder } from 'typeorm';
|
|
|
import { FindOptionsUtils } from 'typeorm/find-options/FindOptionsUtils';
|
|
|
|
|
|
import {
|
|
|
@@ -73,7 +73,7 @@ export class ElasticsearchIndexerController implements OnModuleInit, OnModuleDes
|
|
|
private asyncQueue = new AsyncQueue('elasticsearch-indexer', 5);
|
|
|
|
|
|
constructor(
|
|
|
- @InjectConnection() private connection: Connection,
|
|
|
+ private connection: TransactionalConnection,
|
|
|
@Inject(ELASTIC_SEARCH_OPTIONS) private options: Required<ElasticsearchOptions>,
|
|
|
private productVariantService: ProductVariantService,
|
|
|
) {}
|
|
|
@@ -581,7 +581,11 @@ export class ElasticsearchIndexerController implements OnModuleInit, OnModuleDes
|
|
|
productId: 'ASC',
|
|
|
},
|
|
|
});
|
|
|
- FindOptionsUtils.joinEagerRelations(qb, qb.alias, this.connection.getMetadata(ProductVariant));
|
|
|
+ FindOptionsUtils.joinEagerRelations(
|
|
|
+ qb,
|
|
|
+ qb.alias,
|
|
|
+ this.connection.rawConnection.getMetadata(ProductVariant),
|
|
|
+ );
|
|
|
qb.leftJoin('variants.product', '__product')
|
|
|
.leftJoin('__product.channels', '__channel')
|
|
|
.where('__channel.id = :channelId', { channelId })
|