Skip to content

Commit

Permalink
fix(core): Fix ProductService.assignProductsToChannel to properly ass…
Browse files Browse the repository at this point in the history
…ign assets to channel (#1235)
  • Loading branch information
vrosa authored Nov 22, 2021
1 parent 43cf81e commit a3066b0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/service/services/product.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export class ProductService {
* Assigns a Product to the specified Channel, and optionally uses a `priceFactor` to set the ProductVariantPrices
* on the new Channel.
*
* Internally, this method will also call {@link ProductVariantService} `assignassignProductVariantsToChannel()` for
* Internally, this method will also call {@link ProductVariantService} `assignProductVariantsToChannel()` for
* each of the Product's variants, and will assign the Product's Assets to the Channel too.
*/
async assignProductsToChannel(
Expand All @@ -269,7 +269,7 @@ export class ProductService {
priceFactor: input.priceFactor,
});
const assetIds: ID[] = unique(
([] as ID[]).concat(...productsWithVariants.map(p => p.assets.map(a => a.id))),
([] as ID[]).concat(...productsWithVariants.map(p => p.assets.map(a => a.assetId))),
);
await this.assetService.assignToChannel(ctx, { channelId: input.channelId, assetIds });
const products = await this.connection.getRepository(ctx, Product).findByIds(input.productIds);
Expand Down

0 comments on commit a3066b0

Please sign in to comment.