This is a simple project for car rental which contains API backend (Java, Spring and Hibernate) and database (SQLite).
Database contains three tables: Cars, Clients and Rents. Database schema presented below:
-
GET /car
returns the list of all cars with status 200 -
GET /car/{id}
returns the car specified byid
with status 200 or status 400 if car is not found -
POST /car
adds the car with parametersbrand
,model
andavailable
given in body, returns 201 if created, 400 otherwise -
PUT /car/{id}
updates existing car specified by givenid
with parametersbrand
,model
andavailable
given in body, returns 200 if updated, 400 otherwise -
DELETE /car/{id}
deletes existing car specified by givemid
, returns 200 if deleted, 400 otherwise -
GET /client
returns the list of all clients with status 200 -
GET /client/{id}
returns the client specified byid
with status 200 or status 400 if client is not found -
POST /client
adds the client with parametersfirstname
andlastname
given in body, returns 201 if created, 400 otherwise -
PUT /client/{id}
updates existing client specified by givenid
with parametersfirstname
andlastname
given in body, returns 200 if updated, 400 otherwise -
DELETE /client/{id}
deletes existing client specified by givemid
, returns 200 if deleted, 400 otherwise -
GET /rent
returns the list of all rents with status 200 -
GET /rent/{id}
returns the rent specified byid
with status 200 or status 400 if rent is not found -
POST /rent
adds the rent with parameterscar_id
andclient_id
given in body, returns 201 if created, 400 otherwise -
PATCH /rent/{id}
sets the rent specified byid
as returned: setsreturndate
to current time and sets car as available; returns 200 if updated, 400 otherwise -
PUT /rent/{id}
updates existing rent specified by givenid
with parameterscar_id
andclient_id
given in body, returns 200 if updated, 400 otherwise -
DELETE /rent/{id}
deletes existing rent specified by givemid
, returns 200 if deleted, 400 otherwise