feat: extract Order bounded context into standalone microservice#6
Open
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Open
feat: extract Order bounded context into standalone microservice#6devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Conversation
- Add Order.Domain: OrderEntity, OrderDetail entities, IOrderRepository, IOrderService interfaces - Add Order.Infrastructure: OrderDbContext (PostgreSQL), OrderRepository, OrderService, EF Core migration - Add Order.API: full CRUD controller, Program.cs DI wiring, health checks, Swagger - Add Shared.Contracts: OrderDto, OrderDetailDto, CreateOrderRequest, UpdateOrderRequest DTOs - Add Order.SmokeTests: integration smoke tests using WebApplicationFactory + in-memory DB - Fix Shared project reference paths in all service .csproj files (..\..\Shared -> ..\..\..\Shared) - Dockerfile: multi-stage build for order-service (port 5003)
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extracts the Order bounded context from the monolith into a standalone
order-servicemicroservice, and refactors the monolith to delegate all Order operations to it via HTTP.Microservices repo changes:
Order.Domain:OrderEntity,OrderDetailentities;IOrderRepository,IOrderServiceinterfacesOrder.Infrastructure:OrderDbContext(PostgreSQL/Npgsql),OrderRepository,OrderService, EF Core initial migrationOrder.API: full CRUD controller (GET/POST/PUT/DELETE /api/order), health check at/healthz, Swagger, auto-migration on startupShared.Contracts/DTOs:OrderDto,OrderDetailDto,CreateOrderRequest,UpdateOrderRequestTests/Order.SmokeTests: 7 xunit integration tests usingWebApplicationFactory+ EF in-memory DBShared.Contracts/Shared.Infrastructureproject reference paths in all 5 service.csprojfiles (..\..\Shared→..\..\..\Shared) — these were broken before this PRMonolith repo changes:
IOrdersService/OrdersService: replaced direct EF/SQL Server access with a typedHttpClientcalling order-service REST endpointsOrderController: new REST controller proxying to order-serviceOrderVM: expanded withCustomerId,CashierId,OrderDetails; addedCreateOrderVM,UpdateOrderVMProgram.cs: registersAddHttpClient<IOrdersService, OrdersService>with base URL fromServices:OrderServiceUrlconfigdocker-compose.dev.yml: local dev stack (monolith + order-service + SQL Server + PostgreSQL)Review & Testing Checklist for Human
Smoke test startup bug:
Program.cscallsdb.Database.Migrate()unconditionally at startup. EF Core'sMigrate()throws on an in-memory database. The smoke tests override the DbContext registration viaWithWebHostBuilder, but the migration runs duringWebApplication.Run()after service configuration. Verify the smoke tests actually pass (dotnet test src/Tests/Order.SmokeTests) — they may fail withInvalidOperationException: Relational-specific methods can only be used for relational database providers.Data split in monolith:
CustomerService.GetAllCustomersData()still does.Include(c => c.Orders).ThenInclude(...)directly against SQL Server. Orders created via the newOrderControllergo to PostgreSQL (order-service), but the customer endpoint still reads from SQL Server. The monolith'sApplicationDbContextstill hasDbSet<Order>and the EF model is unchanged — no migration was created to remove Order tables. Decide whether this split is intentional for the workshop or needs to be resolved.No authorization on
OrderController: The new monolithOrderControllerhas no[Authorize]attribute, unlikeCustomerControllerandProductController. Verify this is intentional.docker-compose.dev.ymlrelative path: The Compose file references../app-dotnet-angular-containerized-decomposition-microservices/srcfor the order-service build context, assuming both repos are cloned as siblings. Test thatdocker compose -f docker-compose.dev.yml up --buildworks from the expected directory.End-to-end HTTP path untested: The monolith→order-service HTTP call was never exercised with both services running. Run both services locally (or via Docker Compose) and verify a
POST /api/orderthrough the monolith creates an order in the order-service PostgreSQL DB.Notes
OrderEntityclass lives inOrder.cs(filename/classname mismatch) to avoid a namespace collision with theOrdernamespace — this is intentional..csprojpath fix for all 5 services is a pre-existing bug unrelated to the Order extraction; it's included here because it was blocking the solution build.Dockerfilefor order-service was pre-existing scaffolding and was not modified.Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/2de314a3ccd041ab972baf3609216956
Requested by: @bsmitches