EventStore / samples

Samples showing practical aspect of EventStoreDB, Event Sourcing
https://developers.eventstore.com/
MIT License
70 stars 24 forks source link

Remove product from cart is not updating projection #27

Closed SamAllen83 closed 5 months ago

SamAllen83 commented 6 months ago

Steps to reproduce

  1. Import attached postman collection
  2. Run CQRS_Flow/Java/event-sourcing-esdb-aggregates or CQRS_Flow/Java/event-sourcing-esdb-simple application locally
  3. Send 1. Open Shopping Cart Postman request. This will store ETag and Location for future requests.
  4. Send 2. Add Product To Cart Postman request. This will update stored ETag for future requests.
  5. Send 3. Get Cart By Id Postman request. This will store productId and unitPrice for future requests.
    • Notice Shopping Cart has 1 product in productItems
  6. Send 4. Remove Product From Cart Postman request. This will update stored ETag for future requests.
  7. Send 3. Get Cart By Id Postman request.

Expected Result

Actual Result

Developer Note: I will submit a PR to fix. The issue is this line of code:

view.getProductItems().remove(existingProductItem);

Should be

view.getProductItems().remove(existingProductItem.get());

existingProductItem is of type 'Optional', need to call .get() to get ShoppingCartDetailsProductItem.

event-sourcing-esdb-aggregates.postman_collection.json

josephcummings commented 5 months ago

Closing as fixed in #28