feat(orders): POST /orders grava pedido + OrderPlaced no outbox (fase 2) - #2
Conversation
Primeiro uso real do outbox da fase 1: criar um pedido persiste o agregado Order e o evento OrderPlaced na MESMA transação (sem dual-write, ADR-001). - Domain: agregado Order (Pending/Confirmed/Cancelled) com factory Place() + guards - Infrastructure: OrdersDbContext deriva de MessagingDbContext (order+outbox+inbox no schema orders, ADR-005); OrderConfiguration snake_case; design-time factory - Migrations EF reais (InitialCreate: schema orders + 3 tabelas + ix_outbox_pending); dotnet-ef como tool local (.config/dotnet-tools.json) - Feature PlaceOrder: handler cria Order + outbox.Add(OrderPlaced) + 1 SaveChanges - Host: DI completa, migrate no startup, endpoint POST /orders - Teste de integração (Testcontainers Postgres) prova persistência atômica Infra: EF Core alinhado a 10.0.4 (versão contra a qual o Npgsql 10.0.2 foi compilado) para unificar o grafo e zerar o aviso MSB3277. Migrations marcadas como código gerado no .editorconfig. Build limpo (0/0); unit 4/4; integration PlaceOrder + Outbox verdes.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (17)
📝 WalkthroughWalkthroughThis PR implements a complete Orders service microservice with domain-driven design, EF Core persistence on PostgreSQL, transactional order placement with outbox messaging, and integration tests. Changes include domain models, database schema and migrations, a feature handler, full service wiring, and validation of the atomic persist-and-enqueue workflow. ChangesOrders Service Implementation
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
… 2) (#2) Primeiro uso real do outbox da fase 1: criar um pedido persiste o agregado Order e o evento OrderPlaced na MESMA transação (sem dual-write, ADR-001). - Domain: agregado Order (Pending/Confirmed/Cancelled) com factory Place() + guards - Infrastructure: OrdersDbContext deriva de MessagingDbContext (order+outbox+inbox no schema orders, ADR-005); OrderConfiguration snake_case; design-time factory - Migrations EF reais (InitialCreate: schema orders + 3 tabelas + ix_outbox_pending); dotnet-ef como tool local (.config/dotnet-tools.json) - Feature PlaceOrder: handler cria Order + outbox.Add(OrderPlaced) + 1 SaveChanges - Host: DI completa, migrate no startup, endpoint POST /orders - Teste de integração (Testcontainers Postgres) prova persistência atômica Infra: EF Core alinhado a 10.0.4 (versão contra a qual o Npgsql 10.0.2 foi compilado) para unificar o grafo e zerar o aviso MSB3277. Migrations marcadas como código gerado no .editorconfig. Build limpo (0/0); unit 4/4; integration PlaceOrder + Outbox verdes.
Summary by CodeRabbit
New Features
Tests
Chores