feat: add product sold event handling

Add sell_product() service method that creates ProductSold events
with calculated unit_price_cents (floor division of total/qty).
Update ProductsProjection to handle PRODUCT_SOLD events.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-29 09:40:34 +00:00
parent c82104b029
commit b48fab5dde
4 changed files with 284 additions and 19 deletions

10
PLAN.md
View File

@@ -179,11 +179,11 @@ Check off items as completed. Each phase builds on the previous.
- [x] **Commit checkpoint** (c08fa47)
### Step 4.5: Product Sold Event
- [ ] Implement apply_product_sold projection
- [ ] Add sell_product to services/products.py
- [ ] Calculate unit_price_cents = floor(total/qty)
- [ ] Write tests: event stored, unit price calculated
- [ ] **Commit checkpoint**
- [x] Implement apply_product_sold projection
- [x] Add sell_product to services/products.py
- [x] Calculate unit_price_cents = floor(total/qty)
- [x] Write tests: event stored, unit price calculated
- [x] **Commit checkpoint**
---