Skip to content

Commit

Permalink
fix(core): OrderLineEvent includes ID of deleted OrderLine
Browse files Browse the repository at this point in the history
Fixes #2574
  • Loading branch information
michaelbromley committed Dec 11, 2023
1 parent d09452e commit ee04032
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/core/src/service/services/order.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -588,8 +588,9 @@ export class OrderService {
let updatedOrderLines = [orderLine];
if (correctedQuantity === 0) {
order.lines = order.lines.filter(l => !idsAreEqual(l.id, orderLine.id));
const deletedOrderLine = new OrderLine(orderLine);
await this.connection.getRepository(ctx, OrderLine).remove(orderLine);
this.eventBus.publish(new OrderLineEvent(ctx, order, orderLine, 'deleted'));
this.eventBus.publish(new OrderLineEvent(ctx, order, deletedOrderLine, 'deleted'));
updatedOrderLines = [];
} else {
await this.orderModifier.updateOrderLineQuantity(ctx, orderLine, correctedQuantity, order);
Expand Down Expand Up @@ -620,8 +621,9 @@ export class OrderService {
const orderLine = this.getOrderLineOrThrow(order, orderLineId);
order.lines = order.lines.filter(line => !idsAreEqual(line.id, orderLineId));
const updatedOrder = await this.applyPriceAdjustments(ctx, order);
const deletedOrderLine = new OrderLine(orderLine);
await this.connection.getRepository(ctx, OrderLine).remove(orderLine);
this.eventBus.publish(new OrderLineEvent(ctx, order, orderLine, 'deleted'));
this.eventBus.publish(new OrderLineEvent(ctx, order, deletedOrderLine, 'deleted'));
return updatedOrder;
}

Expand Down

0 comments on commit ee04032

Please sign in to comment.