This API mimics user management functionalities to include creating, updating and deleting user profiles and their product portfolios.
The Farmers API allows users to create and manage their accounts on the platform. Add multiple addresses and multiple value chains and also manage them
- Clone this repository
https://github.com/Gichia/soko-fresh-challenge.git
- Navigate to the cloned repository
- Python3.10
- Postman
- Git
- Create a virtual environment
python3.10 -m venv ./venv
- Activate the virtual environment
source venv/bin/activate
- Switch to 'develop' branch on git
git checkout develop
- Install requirements
pip install -r requirements.txt
uvicorn app.main:app --port 8000
The application docs can be accessed on a browser on the specified port.
http://localhost:8000/docs
When you run the application, you can also test the following endpoints using postman
The API is also shipped with docker files for easy installation. Requires only the
.env
file and you are good to go.
- Docker
- Docker Compose
docker-compose up
The application docs can be accessed on a browser on the specified port.
http://localhost:8001/docs
A live version of the API can be accessed at
https://soko-fresh-challenge.herokuapp.com/docs
.
Unrestricted endpoints
Endpoint | Functionality |
---|---|
GET / | Show sthe welcome message |
POST /auth/register | Register a new user |
POST /auth/login | Login a user |
Restricted endpoints
Endpoint | Functionality |
---|---|
GET /users | Get all users paginated |
GET /users/<user_id> | Get user details |
PUT /users | Update the logged in user details |
DELETE /users | Delete the user account plus their addresses and value chains |
POST /users/address | Add a new address |
PUT /users/address/<addr_id> | Update the address details |
DELETE /users/address/<addr_id> | Delete an address |
POST /value_chains | Add a new value chain |
PUT /value_chains/<chain_id> | Update the value chain details |
DELETE /value_chains/<chain_id> | Delete a value chain |
Peter Gichia -Created By-Gichia
This project is licensed under the MIT license. See LICENSE for details.