Преглед изворни кода

fix(core): Fix publishing CustomerEvent without customer ID

Michael Bromley пре 4 година
родитељ
комит
03cd5d7391
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      packages/core/src/service/services/customer.service.ts

+ 1 - 1
packages/core/src/service/services/customer.service.ts

@@ -544,7 +544,7 @@ export class CustomerService {
             customer = patchEntity(existing, input);
             customer = patchEntity(existing, input);
             customer.channels.push(await this.connection.getEntityOrThrow(ctx, Channel, ctx.channelId));
             customer.channels.push(await this.connection.getEntityOrThrow(ctx, Channel, ctx.channelId));
         } else {
         } else {
-            customer = new Customer(input);
+            customer = await this.connection.getRepository(ctx, Customer).save(new Customer(input));
             this.channelService.assignToCurrentChannel(customer, ctx);
             this.channelService.assignToCurrentChannel(customer, ctx);
             this.eventBus.publish(new CustomerEvent(ctx, customer, 'created'));
             this.eventBus.publish(new CustomerEvent(ctx, customer, 'created'));
         }
         }