You need docker and docker compose installed
These commands will build&launch web server, database, run tests, migrations and fill db with initial data (around 26 hotels and some amenties)
git clone [email protected]:snbby/hotels-backend.git
cd hotels-backend
docker compose build
docker compose up
Swagger documentation will be available on http://localhost:8000/api/schema/swagger-ui/
You can import this link to Postman and try instantly
pip3 install -r requirements.txt #install dependencies
python3 manage.py migrate hotels
pytest #run tests
python3 manage.py scrape_hotels #fill with initial data
python3 manage.py runserver
Environment variables defined in hotels.settings.py
You can export yours if you want:
export HOTELS_DATABASE_NAME=some_db
export HOTELS_DATABASE_USER=pampam
export HOTELS_DATABASE_PASS=purumpurum
export HOTELS_DATABASE_HOST=localhost
export HOTELS_DATABASE_PORT=9999
export HOTELS_DEBUG=True
POST request contract for amenity param changed a bit in comparison to Notion: ["wifi", "parking"]
to [{"title": "wifi"}, {"title": "parking"}]
. If the Amenity model will extend, it will be needed for adding additional params
Average price wasn't added to the model. It's not clear what average price to pick (for one day or several days, for 1 or 2 bed).