Feat/idr rate aggregator#223
Open
BiasCoder wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Implements the “IDR rate aggregator” Spring Boot service: fetches multiple Frankfurter API resources at startup via strategy implementations, stores an immutable snapshot in-memory, and exposes a single polymorphic REST endpoint to serve the preloaded data.
Changes:
- Added Strategy pattern fetchers for
latest_idr_rates,historical_idr_usd, andsupported_currencies, plus wiring via a SpringMap<String, IDRDataFetcher>. - Added startup
ApplicationRunnerthat loads all resources once and publishes an immutable snapshot intoFinanceDataStore. - Added REST controller endpoint
GET /api/finance/data/{resourceType}and unit tests for fetchers/initializer.
Reviewed changes
Copilot reviewed 21 out of 37 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| target/test-classes/com/allobank/finance/strategy/WebClientStub.class | Compiled test artifact committed (should not be in VCS). |
| target/test-classes/com/allobank/finance/strategy/SupportedCurrenciesFetcherTest.class | Compiled test artifact committed (should not be in VCS). |
| target/test-classes/com/allobank/finance/strategy/LatestIdrRatesFetcherTest.class | Compiled test artifact committed (should not be in VCS). |
| target/test-classes/com/allobank/finance/strategy/HistoricalIdrUsdFetcherTest.class | Compiled test artifact committed (should not be in VCS). |
| target/test-classes/com/allobank/finance/runner/FinanceDataInitializerTest.class | Compiled test artifact committed (should not be in VCS). |
| target/classes/com/allobank/finance/strategy/SupportedCurrenciesFetcher.class | Compiled main artifact committed (should not be in VCS). |
| target/classes/com/allobank/finance/strategy/LatestIdrRatesFetcher.class | Compiled main artifact committed (should not be in VCS). |
| target/classes/com/allobank/finance/strategy/IDRDataFetcher.class | Compiled main artifact committed (should not be in VCS). |
| target/classes/com/allobank/finance/strategy/HistoricalIdrUsdFetcher.class | Compiled main artifact committed (should not be in VCS). |
| target/classes/com/allobank/finance/store/FinanceDataStore.class | Compiled main artifact committed (should not be in VCS). |
| target/classes/com/allobank/finance/runner/FinanceDataInitializer.class | Compiled main artifact committed (should not be in VCS). |
| target/classes/com/allobank/finance/exception/FinanceDataLoadException.class | Compiled main artifact committed (should not be in VCS). |
| target/classes/com/allobank/finance/controller/FinanceDataController.class | Compiled main artifact committed (should not be in VCS). |
| target/classes/com/allobank/finance/config/FrankfurterClientFactoryBean.class | Compiled main artifact committed (should not be in VCS). |
| target/classes/com/allobank/finance/config/FetcherStrategyConfig.class | Compiled main artifact committed (should not be in VCS). |
| target/classes/com/allobank/finance/AlloBankApplication.class | Compiled main artifact committed (should not be in VCS). |
| target/classes/application.yml | Generated build output committed (should not be in VCS). |
| src/test/java/com/allobank/finance/strategy/WebClientStub.java | Adds WebClient stub to test URL building and JSON handling. |
| src/test/java/com/allobank/finance/strategy/SupportedCurrenciesFetcherTest.java | Unit test for currencies fetcher sorting/shape. |
| src/test/java/com/allobank/finance/strategy/LatestIdrRatesFetcherTest.java | Unit test for latest rates + personalized spread calculation. |
| src/test/java/com/allobank/finance/strategy/HistoricalIdrUsdFetcherTest.java | Unit test for historical fetcher ordering/URL parameters. |
| src/test/java/com/allobank/finance/runner/FinanceDataInitializerTest.java | Validates startup runner loads all strategies and store immutability. |
| src/main/resources/application.yml | Adds Frankfurter client configuration (base URL/timeouts). |
| src/main/java/com/allobank/finance/strategy/SupportedCurrenciesFetcher.java | Fetches /currencies and transforms to sorted rows. |
| src/main/java/com/allobank/finance/strategy/LatestIdrRatesFetcher.java | Fetches /latest?base=IDR, computes USD_BuySpread_IDR, adds metadata. |
| src/main/java/com/allobank/finance/strategy/IDRDataFetcher.java | Introduces strategy interface for polymorphic data resources. |
| src/main/java/com/allobank/finance/strategy/HistoricalIdrUsdFetcher.java | Fetches historical range and transforms into sorted date rows. |
| src/main/java/com/allobank/finance/store/FinanceDataStore.java | Thread-safe in-memory store with defensive immutability snapshotting. |
| src/main/java/com/allobank/finance/runner/FinanceDataInitializer.java | ApplicationRunner that loads each strategy once and publishes to store. |
| src/main/java/com/allobank/finance/exception/FinanceDataLoadException.java | Custom runtime exception for startup/data load failures. |
| src/main/java/com/allobank/finance/controller/FinanceDataController.java | Polymorphic endpoint serving immutable preloaded data. |
| src/main/java/com/allobank/finance/config/FrankfurterClientFactoryBean.java | FactoryBean producing configured WebClient (timeouts/base URL/headers). |
| src/main/java/com/allobank/finance/config/FetcherStrategyConfig.java | Wires fetcher implementations into idrDataFetcherMap. |
| src/main/java/com/allobank/finance/AlloBankApplication.java | Adds Spring Boot application entrypoint. |
| pom.xml | Adds Spring Boot WebFlux + test dependencies and build plugin. |
| README.md | Updates docs, usage, and architecture notes. |
| .vscode/settings.json | Adds VS Code workspace settings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+26
to
+34
| ```yaml | ||
| frankfurter: | ||
| base-url: https://api.frankfurter.app/ | ||
| connect-timeout-ms: 5000 | ||
| read-timeout-ms: 5000 | ||
|
|
||
| 2. **Historical Data:** Query a specific, small time series (e.g., `/2024-01-01..2024-01-05?from=IDR&to=USD`). **Note:** *Use the date range provided in this example unless a different range is communicated separately.* | ||
| app: | ||
| github-username: biascoder | ||
| ``` |
Comment on lines
+1
to
+4
| frankfurter: | ||
| base-url: https://api.frankfurter.app/ | ||
| connect-timeout-ms: 5000 | ||
| read-timeout-ms: 5000 |
Comment on lines
+2
to
+3
| "java.configuration.updateBuildConfiguration": "interactive", | ||
| "java.compile.nullAnalysis.mode": "automatic" |
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.
No description provided.