Skip to content

MuhweziDeo/Fast-foods-Fast-challenge3

Repository files navigation

Fast Foods Fast Challenge3

A Restaurant Food Delivery and ordering API

Build Status

Coverage Status

Maintainability

Project Repo

https://github.com/MuhweziDeo/Fast-foods-Fast-challenge3.git

Live Demo Link and Documentation

https://fast-foods-api-main.herokuapp.com/

Functionality

  • 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.

Dependencies Used

  • Flask(python web framework )
  • Flask_Restplus(flask framework for building APis)
  • Pytest(Testing Framework)
  • Flask-Jwt-extended(Json Web Token authentication library)
  • Postgres(Database)

Database Structure

users.

column name type
user_id int(primary key,unique)
username character(unique)
password characters
admin boolen

fastfoods.

column type
meal_id int(unique)
meal_name varchar(unique)
meal_status varchar(Default Availabe)

orders.

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)

End Points

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)

How to use

  • 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" }

Running locally and Testing

Before testing Ensure you have Postgres installed and change password for local user

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
  1. Testing
  • cd into project directory
  • Set up enviroment for testing using export APP_SETTINGS='testing'
  • open terminal and run py.test --cov

Break down of tests

  • 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

Developed by

  • Muhwezi Deo

Releases

No releases published

Packages

No packages published

Languages