Skip to content

Feat/idr rate aggregator#223

Open
BiasCoder wants to merge 2 commits into
allobankdev:mainfrom
BiasCoder:feat/idr-rate-aggregator
Open

Feat/idr rate aggregator#223
BiasCoder wants to merge 2 commits into
allobankdev:mainfrom
BiasCoder:feat/idr-rate-aggregator

Conversation

@BiasCoder
Copy link
Copy Markdown

No description provided.

Copilot AI review requested due to automatic review settings April 16, 2026 15:04
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and supported_currencies, plus wiring via a Spring Map<String, IDRDataFetcher>.
  • Added startup ApplicationRunner that loads all resources once and publishes an immutable snapshot into FinanceDataStore.
  • 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 thread README.md
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 thread .vscode/settings.json
Comment on lines +2 to +3
"java.configuration.updateBuildConfiguration": "interactive",
"java.compile.nullAnalysis.mode": "automatic"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants