Application meant for getting hike recommendations.
Built with Java 17, Spring Boot & H2.
Initial data is loaded from src/main/resources/data.sql
.
- Kilometers (
long lengthInKilometers
) - Season (
String season
)
- Sleepover count (
int sleepoverCount
)- Based on kilometers
- Food calories (
int foodCalories
)- Based on base daily calories, kilometers & season, which applies multipliers
- Liters of water (
double litersOfWater
)- Based on kilometers & season, which applies multipliers
- Items (
List<String> items
)- Based on season
In the Constants
file, you can modify:
- after how many kilometers you should sleep (with the
KILOMETERS_BEFORE_SLEEP
property) - base daily calories (with the
BASE_DAILY_CALORIES
property) - amount of calories burned per kilometer (with the
CALORIES_BURNED_PER_KILOMETER
property) - for how many kilometers 1 litre of water should be sufficient (with the
KILOMETERS_PER_WATER_LITRE
property)
🎯 Purpose: get hike recommendations.
Success request body example:
{
"lengthInKilometers": 200,
"season": "winter"
}
Success response status code: 200
Success response body example:
{
"sleepoverCount": 4,
"foodCalories": 23000,
"litersOfWater": 20.0,
"items": [
"scarf",
"gloves",
"earmuffs"
]
}
Exception request body example:
{
"lengthInKilometers": 200,
"season": "abc"
}
Exception response status code: 400
Exception response body example:
{
"message": "Invalid season 'abc' provided"
}
🎯 Purpose: get item.
Success response status code: 200
Success response body example:
{
"id": 13,
"name": "sunglasses",
"season": "summer"
}
Exception response status code: 400
Exception response body example:
{
"message": "Item with provided ID not found"
}
🎯 Purpose: get all items.
Success response status code: 200
Success response body example:
[
{
"id": 1,
"name": "cap",
"season": "summer"
},
{
"id": 2,
"name": "insect repellent",
"season": "summer"
}
]
🎯 Purpose: create item.
Request body example:
{
"name": "Sunglasses",
"season": "Summer"
}
Success response status code: 201
Success response body example:
{
"id": 13,
"name": "sunglasses",
"season": "summer"
}
Exception request body example:
{
"name": "Sunglasses",
"season": "abc"
}
Exception response status code: 400
Exception response body example:
{
"message": "Invalid season 'abc' provided"
}
🎯 Purpose: delete item.
Success response status code: 204