Skip to content

Order update Handler does not load or synchronize OrderItems #102

@PremalWonderbiz

Description

@PremalWonderbiz

Problem

During order update, the current implementation retrieves the order using:

var order = await dbContext.Orders
    .FindAsync([orderId], cancellationToken);

This does not load OrderItems, so the aggregate is partially hydrated.

Consequences

Because of this:

  • OrderItems are empty during update
  • Order-level calculations (e.g. TotalPrice) can become incorrect (often 0)
  • Changes to order items (update quantity/price, add, or remove items) are not handled

Expected Behavior

When updating an order:

  • The Order aggregate should be loaded together with its OrderItems
  • Updates to order items (add / update / remove) should be reflected in the aggregate
  • Order calculations should be based on the actual persisted items

Suggested Direction

Load the order with its items:

dbContext.Orders
    .Include(o => o.OrderItems);

Synchronize OrderItems through the Order aggregate during update.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions