The following are the instructions for running the project. This project runs requires python 3.9.
Use the package manager pipenv to install the project, and configure environment vars:
pipenv install
export DEBUG=true
export DJANGO_SETTINGS_MODULE=optimhiretest.settings
export PYTHONUNBUFFERED=1
Activate virtual environment:
pipenv shell
Then go to src folder, and run the project via manage.py runserver command:
python manage.py runserver
The API is now running on Port 8000 at localhost.
You can test the API using postman, you can import it from the project or run it directly from: here
You'll find 7 requests inside the collection:
Create a room with N capacity
POST /api/room/
body
{
"capacity": 46
}
List all created rooms
GET /api/room/
List all public events
POST /api/room/{room-id}/event/
path params: "room-id" id of the room where the event is going to be created
body
{
"date": "2022-08-27",
"type": "public"
}
List all public events
GET /api/room/event
Create a booking for a place in a public event
POST /api/room/{room-id}/event/{event-id}/book/?customer_id={customer-id}
path params:
"room-id" the id of the room
"event-id" the id of the event
query-params:
"customer-id" an identifier for a customer
body
{
"requested_capacity": 300
}
List all booked places
GET /api/room/event/book/
Cancel a Place that's already booked
DELETE /api/room/event/book/{book-id}/?customer_id={customer-id}