This is a simple microservice for calculating vacation pay based on average salary and the number of vacation days. The project is built with Java 17 and Spring Boot.
- Calculate Gross and Net vacation pay
- Detailed and simple responses
- Custom validation & error handling
- Detailed logging
- Unit testing for services
- Docker support
-
URL:
/calculate
-
Method:
GET
-
Query Parameters:
averageSalary
(required): Average salary for the last 12 months.vacationDays
(required): Number of vacation days.vacationDates
(optional): Specific vacation dates to consider holidays and weekends.vacationStartDate
(optional): Start date of the vacation period.vacationEndDate
(optional): End date of the vacation period.
-
Responses:
- If
vacationDates
are not provided:- SimpleVacationPayResponseDto:
{ "vacationPay": "BigDecimal", "message": "String" }
- SimpleVacationPayResponseDto:
- If
vacationDates
are provided:- DetailedVacationPayResponseDto:
{ "vacationPay": "BigDecimal", "weekendsAndHolidays": "int", "paidVacationDays": "int", "message": "String" }
- DetailedVacationPayResponseDto:
- If
The API handles various exceptions and returns appropriate HTTP status codes and error messages:
- 400 Bad Request: For invalid input, missing parameters, or validation errors.
- 500 Internal Server Error: For unexpected errors.
- Java 17
- Spring Boot
- Spring Web
- Maven
- Hibernate Validator: 8.0.0
- MapStruct: 1.5.2
- JUnit 5
- Mockito
- Log4j: 2.23.1
- SpringDoc OpenAPI: 2.5.0
- Docker
-
Clone the repository:
git clone https://github.com/akerumort/vacation-pay-calculator.git cd vacation-pay-calculator
-
Build and start the containers:
docker build -t vacation-pay-calculator .
-
Run the Docker container
docker run -p 8080:8080 vacation-pay-calculator
-
The application will start on http://localhost:8080
- Run the tests using Maven:
mvn test
- Available on:
http://localhost:8080/swagger-ui/index.html
This project is licensed under the MIT License. See the LICENSE
file for more details.
For any questions or inquiries, please contact [email protected]
.