This project is a clustered data warehouse application designed to accept and persist FX deal details into a database. The application is developed using Spring Boot and supports various database systems, including PostgreSQL. The project follows best practices, including validation, exception handling, logging, unit testing, and documentation.
- Java 17
- Maven
- Docker & Docker Compose
src
├── main
│ └── java
│ └── org.med.clustereddatawarehouse
│ ├── config
│ │ ├── AuditConfig.java
│ │ └── ModelMapperConfig.java
│ ├── controller
│ │ └── FxDealController.java
│ ├── exception
│ │ └── ResourceAlreadyExistException.java
│ ├── model
│ │ ├── entity
│ │ │ └── FxDeal.java
│ │ └── request
│ │ └── FxDealReqDto.java
│ ├── repository
│ │ └── FxDealRepository.java
│ ├── service
│ │ ├── FxDealService.java
│ │ └── impl
│ │ └── FxDealServiceImpl.java
│ └── util
│ │ └── GlobalExceptionHandler.java
│ └── ClusteredDataWarehouseApplication.java
└── test
│ └── java
│ └── org.med.clustereddatawarehouse
│ └── service.impl
│ │ └── FxDealServiceImplTest.java
│ └── ClusteredDataWarehouseApplicationTests.java
│── compose.yaml
├── Dockerfile
├── Makefile
├── pom.xml
└── README.md
Create an .env
file in the root directory with the following content:
POSTGRESDB_USER=yourusername
POSTGRESDB_ROOT_PASSWORD=yourpassword
POSTGRESDB_DATABASE=yourdbname
POSTGRESDB_LOCAL_PORT=5432
POSTGRESDB_DOCKER_PORT=5432
SPRING_LOCAL_PORT=8080
SPRING_DOCKER_PORT=8080
Build and start the application:
docker-compose up -d
Stop the application:
docker-compose down
make build
make run
make stop
Once the app starts, you can open the link below to see and test the API endpoint:
http://localhost:8080/swagger-ui.html
Alternatively, you can test the API endpoints using Postman:
- URL:
http://localhost:8080/api/v1/fxDeal
- Method: POST
- Body:
{
"id": "ID123",
"orderingCurrencyIsoCode": "USD",
"toCurrencyIsoCode": "EUR",
"dealAmount": 1000.0
}
- Responses:
- 201 Created: Deal successfully saved.
- 400 Bad Request: Validation failed.