|
|
@@ -20,8 +20,8 @@ import { TransactionalConnection } from '../../connection/transactional-connecti
|
|
|
import { Customer } from '../../entity/customer/customer.entity';
|
|
|
import { CustomerGroup } from '../../entity/customer-group/customer-group.entity';
|
|
|
import { EventBus } from '../../event-bus/event-bus';
|
|
|
-import { CustomerGroupEntityEvent } from '../../event-bus/events/customer-group-entity-event';
|
|
|
-import { CustomerGroupChangeEvent, CustomerGroupEvent } from '../../event-bus/events/customer-group-event';
|
|
|
+import { CustomerGroupChangeEvent } from '../../event-bus/events/customer-group-change-event';
|
|
|
+import { CustomerGroupEvent } from '../../event-bus/events/customer-group-event';
|
|
|
import { CustomFieldRelationService } from '../helpers/custom-field-relation/custom-field-relation.service';
|
|
|
import { ListQueryBuilder } from '../helpers/list-query-builder/list-query-builder';
|
|
|
import { patchEntity } from '../helpers/utils/patch-entity';
|
|
|
@@ -107,7 +107,7 @@ export class CustomerGroupService {
|
|
|
}
|
|
|
const savedCustomerGroup = await assertFound(this.findOne(ctx, newCustomerGroup.id));
|
|
|
await this.customFieldRelationService.updateRelations(ctx, CustomerGroup, input, savedCustomerGroup);
|
|
|
- this.eventBus.publish(new CustomerGroupEntityEvent(ctx, savedCustomerGroup, 'created', input));
|
|
|
+ this.eventBus.publish(new CustomerGroupEvent(ctx, savedCustomerGroup, 'created', input));
|
|
|
return assertFound(this.findOne(ctx, savedCustomerGroup.id));
|
|
|
}
|
|
|
|
|
|
@@ -121,7 +121,7 @@ export class CustomerGroupService {
|
|
|
input,
|
|
|
updatedCustomerGroup,
|
|
|
);
|
|
|
- this.eventBus.publish(new CustomerGroupEntityEvent(ctx, customerGroup, 'updated', input));
|
|
|
+ this.eventBus.publish(new CustomerGroupEvent(ctx, customerGroup, 'updated', input));
|
|
|
return assertFound(this.findOne(ctx, customerGroup.id));
|
|
|
}
|
|
|
|
|
|
@@ -130,7 +130,7 @@ export class CustomerGroupService {
|
|
|
try {
|
|
|
const deletedGroup = new CustomerGroup(group);
|
|
|
await this.connection.getRepository(ctx, CustomerGroup).remove(group);
|
|
|
- this.eventBus.publish(new CustomerGroupEntityEvent(ctx, deletedGroup, 'deleted', id));
|
|
|
+ this.eventBus.publish(new CustomerGroupEvent(ctx, deletedGroup, 'deleted', id));
|
|
|
return {
|
|
|
result: DeletionResult.DELETED,
|
|
|
};
|
|
|
@@ -163,7 +163,6 @@ export class CustomerGroupService {
|
|
|
}
|
|
|
|
|
|
await this.connection.getRepository(ctx, Customer).save(customers, { reload: false });
|
|
|
- this.eventBus.publish(new CustomerGroupEvent(ctx, customers, group, 'assigned'));
|
|
|
this.eventBus.publish(new CustomerGroupChangeEvent(ctx, customers, group, 'assigned'));
|
|
|
|
|
|
return assertFound(this.findOne(ctx, group.id));
|
|
|
@@ -190,7 +189,6 @@ export class CustomerGroupService {
|
|
|
});
|
|
|
}
|
|
|
await this.connection.getRepository(ctx, Customer).save(customers, { reload: false });
|
|
|
- this.eventBus.publish(new CustomerGroupEvent(ctx, customers, group, 'removed'));
|
|
|
this.eventBus.publish(new CustomerGroupChangeEvent(ctx, customers, group, 'removed'));
|
|
|
return assertFound(this.findOne(ctx, group.id));
|
|
|
}
|