I used H2 database for persistence and Liquibase for schema management.
There is no booking restrictions per Customer.
- Java 11
docker build -t edych/parking-lot-api .
docker run -p 8080:8080 edych/parking-lot-api
./mvnw clean install
java -jar target/parking-0.0.1-SNAPSHOT.jar
- There are two ParkingFloors, each with 30 ParkingSpots
- There is one Customer:
id: 1, name: edych
- H2 Console is available at
http://localhost:8080/h2
Documentation available at http://localhost:8080/swagger-ui.html
There is postman.json
collection provided in the root of repository.
1. Create a new Reservation
curl -X POST 'localhost:8080/reservation' \
-H 'Content-Type: application/json' \
--data-raw '{"customerId": 1,"parkingSpotId": 5}'
2. Delete Reservation
curl -X DELETE 'localhost:8080/reservation/1'
3. Get a list of all Reservations made by Customer
curl -X GET 'localhost:8080/reservations?customerId=1'
4. Get a list of all available ParkingSpots
curl -X GET 'localhost:8080/parking-spot/available'