|
|
@@ -23,6 +23,7 @@ import { ConfigService } from '../../config/config.service';
|
|
|
import { TransactionalConnection } from '../../connection/transactional-connection';
|
|
|
import { VendureEntity } from '../../entity/base/base.entity';
|
|
|
import { Channel } from '../../entity/channel/channel.entity';
|
|
|
+import { Order } from '../../entity/order/order.entity';
|
|
|
import { ProductVariantPrice } from '../../entity/product-variant/product-variant-price.entity';
|
|
|
import { Session } from '../../entity/session/session.entity';
|
|
|
import { Zone } from '../../entity/zone/zone.entity';
|
|
|
@@ -102,8 +103,16 @@ export class ChannelService {
|
|
|
entityId: ID,
|
|
|
channelIds: ID[],
|
|
|
): Promise<T> {
|
|
|
+ const relations = ['channels'];
|
|
|
+ // This is a work-around for https://github.com/vendure-ecommerce/vendure/issues/1391
|
|
|
+ // A better API would be to allow the consumer of this method to supply an entity instance
|
|
|
+ // so that this join could be done prior to invoking this method.
|
|
|
+ // TODO: overload the assignToChannels method to allow it to take an entity instance
|
|
|
+ if (entityType === (Order as any)) {
|
|
|
+ relations.push('lines', 'shippingLines');
|
|
|
+ }
|
|
|
const entity = await this.connection.getEntityOrThrow(ctx, entityType, entityId, {
|
|
|
- relations: ['channels'],
|
|
|
+ relations,
|
|
|
});
|
|
|
for (const id of channelIds) {
|
|
|
const channel = await this.connection.getEntityOrThrow(ctx, Channel, id);
|