- CRUD for users (POST shouldn’t require authentication)
- CRUD for a product model
- Deposit endpoint so users with a
buyerrole - Buy endpoint (accepts productId, amount of products) so users with a
buyerrole can buy products with the money they’ve deposited. - Reset endpoint so users with a
buyerrole can reset their depos - Unit Testing with PyTest
- Database Connection Using SQLAlchemy
- Python 3.7+
- Pip
- Other listed in requirements.txt
- Clone the repo using
git clone git@github.com:siddythings/vending-machine-fastapi.git- Create a Virtual Environment using
sudo pip install virtualenv
virtualenv env- Activate the virtualenv
env\Scripts\activate # for windows
source env/bin/activate # for linux and mac- Install dependencies
pip install -r requirements.txt- Setting up environment variables
| Key | Value |
|---|---|
| DATABASE_URL | postgresql://user:password@host:port/db |
- To run the project
uvicorn main:app- To run in docker
docker compose up --build- To run Test cases
python run_test.py