Java 17 JDK installed, environment variables are set up: https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html
(I suggest using SDKMAN no matter which OS You use: https://sdkman.io/)
An APIs to calculate the exchange rates need to be exposed defined here under:
- GET /exchange?from=EUR&to=PLN&date=2020-12-05
- from and to parameters should accept currency codes
- date should accept ISO8601 date format (date only)
- 2020-12-05, EUR and PLN are used as examples
- Should return the exchange rate between the provided currencies
- Should use the exchange rate of the day provided in the query parameter date, if not found return 404 not found
- date is optional, if not present latest exchange rate information should be used
- Result should be in JSON format as shown in Appendix 1
- All the information should be retrieved from the cached data in the database
- A counter in the database should be incremented for both currencies indicating a request was made for the date selected
To be able to retrieve the data, a scheduler also needs to be implemented that runs at 12:05 AM GMT and inserts the exchange rates into the database from http://data.fixer.io/api/latest
For this project use as base currency whatever https://fixer.io/ selects for your API key.
./mvnw spring-boot:run -Dspring-boot.run.profiles=dev
./mvnw test
datasource, external API url, api-key and spreads are customizable by editing
- application-dev.yml file [DEV]
- application-prod.yml file [PROD]
- Java
- Spring (Boot, AOP, Retry)
- maven
- Hibernate
- JPA
- Swagger
- Slf4J
- lombok
- jUnit5
- Adapt to reactive world with Spring Webflux
- Add k8s, helm and terraform configuration
- Write some performance and e2e tests
{
“from” : “EUR”,
“to” : “PLN”,
“exchange”: 4.4405487565413254124
}