A Restaurant Food Delivery and ordering API
https://github.com/MuhweziDeo/Fast-foods-Fast-challenge3.git
https://fast-foods-api-main.herokuapp.com/
- Create user accounts that can signin in the app.
- Place an order for food.
- Get list of orders.
- Get a specific order.
- Update the status of an order.
- Get the menu.
- Add food option to the menu.
- View the order history for a particular user.
- Flask(python web framework )
- Flask_Restplus(flask framework for building APis)
- Pytest(Testing Framework)
- Flask-Jwt-extended(Json Web Token authentication library)
- Postgres(Database)
column name | type |
---|---|
user_id | int(primary key,unique) |
username | character(unique) |
password | characters |
admin | boolen |
column | type |
---|---|
meal_id | int(unique) |
meal_name | varchar(unique) |
meal_status | varchar(Default Availabe) |
column | type |
---|---|
orderId | int(unique) primary key |
location | varchar(unique) |
meal_name | varchar(unique) fk(references meal_name) |
quantity | int |
status | varchar(Default New) |
meal_name | varchar(unique) fk(references meal_name in fastfoods) |
user_id | int(fk references user_id in users table) |
quantity | int |
status | varchar(Default New) |
EndPoint | Function |
---|---|
POST /auth/signup |
create a user account |
POST /auth/login |
Verify a user and create access token |
POST /users/orders |
Create an order |
GET /users/orders |
Get orders of a particular user |
GET /orders |
Get all orders(Admin only) |
GET /orders/<orderId> |
Get a particular order by its orderId(Admin only) |
PUT /orders/<orderId> |
update order status of an order(Admin only) |
GET /menu |
view Meals on the menu |
POST /menu |
Add meal option(Admin only) |
-
Super User
{'username':'super',password:"super"}
, this the overall admin user created by default -
Signing up,username,password and confirm password are expected in post data.
{ "username": "string", "password": "string", "confirm": "string" }
password and confrim fields must match before an account is created -
Logging In, Users provide in a username and password which are verified if they belong to any user in the database.
{ "username": "string", "password": "string" }
-
create a meal option,only Admins can create a meal option by entering a meal name and price, by default meal_status is set to Available.
{ "meal_name": "string", "price": 0 }
-
create order, a user can create an order by passing a valid token,location,meal and quantity of the meal they want.
{ "location": "string", "quantity": 0, "meal": "string" }
1.Running Locally
- Clone project repository
git clone https://github.com/MuhweziDeo/Fast-foods-Fast-challenge3.git
- cd into project directory
- Install a virtual enviroment
virtualenv venv
- Activate Enviroment
source venv/bin/activate
- Checkout develop branch -
git checkout develop
- Install dependencies
pip install -r requirements.txt
- run server,open terminal and run
python run.py
- Testing
- cd into project directory
- Set up enviroment for testing using
export APP_SETTINGS='testing'
- open terminal and run
py.test --cov
- Test(test_db) Database CRUD operations. Test all database operations
- Test(test_meals,test_orders,test_users) api endpoints. Test all routes for the api
- Muhwezi Deo