Extract Restaurant Service into independent microservice#186
Open
devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
Open
Extract Restaurant Service into independent microservice#186devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
Conversation
- Create ftgo-restaurant-service-standalone module with Spring Boot app, own domain entities, REST controller, Flyway migrations, and Dockerfile - Replace direct RestaurantRepository usage in OrderService with HTTP RestaurantServiceClient calling Restaurant Service REST API - Replace @manytoone Restaurant FK in Order entity with plain restaurantId and restaurantName fields - Add Restaurant Service to Docker Compose with dedicated database - Add Flyway migration V3 to drop FK constraint and add restaurant_name - Update ftgo-application to remove restaurant service aggregation - Update end-to-end tests to support separate restaurant service port - Update build-and-restart script to include restaurant service - Update MySQL init to create ftgo_restaurant database - Update test mothers to use DTOs instead of domain entities Co-Authored-By: benc <Benc@windsurf.com>
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 Restaurant Service from the FTGO monolith into a standalone Spring Boot microservice with its own database, replacing direct in-process JPA access from the Order Service with HTTP REST calls.
New module:
ftgo-restaurant-service-standaloneRestaurantServiceMain) on port 8085Restaurant,RestaurantMenu,MenuItem) copied fromftgo-domainPOST /restaurantsandGET /restaurants/{id}(includes menu items + address in response)V1__create_restaurant_db.sql) forrestaurantsandrestaurant_menu_itemstablesftgo_restaurant)Order Service decoupling:
OrderServicenow usesRestaurantServiceClient(RestTemplate-based HTTP client) instead ofRestaurantRepositoryOrderentity: replaced@ManyToOne Restaurantwith plainLong restaurantId+String restaurantNamefieldsRestaurantDTO,MenuItemDTOin order service for HTTP communicationrestaurant_namecolumn toorders, backfills fromrestaurantstable, drops FK constraintInfrastructure:
ftgo-restaurant-servicecontainer,ftgo-applicationdepends on it and receivesRESTAURANT_SERVICE_URLenv varftgo_restaurantdatabasebuild-and-restart-application.shnow builds both services/restaurantscalls to the standalone service port (8085)Monolith cleanup:
ftgo-applicationno longer importsRestaurantServiceConfigurationftgo-application/build.gradleremovesftgo-restaurant-servicedependencyReview & Testing Checklist for Human
DistanceOptimizedCourierAssignmentStrategyis now permanently degraded: the removal oforder.getRestaurant()calls meansrestaurantLat/restaurantLngare always null, so distance-based courier assignment is effectively disabled — all assignments fall through to load-balanced. Decide whether this regression is acceptable or if restaurant location should be passed through another mechanism (e.g., stored on Order, or fetched via HTTP).orders_restaurant_id: verify this matches the actual constraint name created by V1. If it doesn't match, the migration will fail at deploy time.Moneytype across the HTTP boundary:RestaurantDTO/MenuItemDTOuseMoneyfor price. Verify the standalone service serializesMoneythe same way the order service deserializes it (both needMoneyModuleregistered, or compatible JSON shape).OrderService.estimateDeliveryTime()now makes a synchronous HTTP call to the Restaurant Service on every invocation. Previously this was an in-memory entity access. Consider latency impact and failure handling (currently wraps in a genericRuntimeException).ftgo-restaurant-servicelibrary module still exists in settings.gradle and still depends onftgo-domainRestaurant entities. The entities were copied to the standalone module but not removed fromftgo-domain. This is intentional to keep the old module compiling, but creates duplicated domain code.Recommended test plan:
docker-compose upand verify bothftgo-application(8081) andftgo-restaurant-service(8085) start successfullyPOST /restaurantsto port 8085, thenGET /restaurants/{id}— confirm menu items and address are returnedrestaurantNameis populatedGET /orders/{id}returnsrestaurantNamecorrectlyDROP FOREIGN KEYstatement)Notes
eventuate-util-test:0.1.0.RELEASEnot found due to JCenter shutdown), so test compilation could not be fully verified../gradlew compileJavapasses when excluding end-to-end test modules).Link to Devin session: https://app.devin.ai/sessions/0cdbbf490eca4a059eb8e2f661c8e25e
Requested by: @bcmake