A simple flask application for restaurant that performs the following functions:
- Sign In/ Sign Up of customers.
- Converting customers into vendors.
- Creating inventory items.
- Placing Order on inventory items.
- Displaying the complete list of items from the inventory.
Entirely made with python and flask.
- Run the following command in command shell :
pip install -r requirements.txt
and make sure that mySQL is installed before the first command.
-
Install mySql and mySQL workbench first. Source : mySql installation on macOS
-
Open mySQL server using the following command :
brew services start mysql
and then run the following command :mysql -uroot
-
Create a database name
restaurant
and use it. -
Run the
main.py
file for starting the deployment flask application.
To make a POST request to the SignUpAPI endpoint using Postman, you would need to configure the following:
-
In the URL field, enter the full URL of your endpoint, including the host and port. For example, if your Flask app is running on http://localhost:5000 and the endpoint is /signup, the full URL would be http://localhost:5000/signup.
-
In the Headers section, add a key-value pair with the key Content-Type and the value application/json.
-
In the Body section, select the raw option, and enter a JSON object containing the required fields for the SignUpRequest schema.
-
In Authorization tab, select the type of authorization you want to use, in this case, it is application secret key
-
Add the key in the value field of the authorization tab
-
Finally, click the Send button to make the POST request.
image.png
To make a POST request to the LoginAPI endpoint using Postman, you would need to configure the following:
-
In the URL field, enter the full URL of your endpoint, including the host and port. For example, if your Flask app is running on http://localhost:5000 and the endpoint is /signup, the full URL would be http://localhost:5000/login.
-
In the Headers section, add a key-value pair with the key Content-Type and the value application/json.
-
In the Body section, select the raw option, and enter a JSON object containing the required fields for the LoginRequest schema.
-
In Authorization tab, select the type of authorization you want to use, in this case, it is application secret key
-
Add the key in the value field of the authorization tab
-
Finally, click the Send button to make the POST request.
image.png
To make a POST request to the LogoutAPI endpoint using Postman, you would need to configure the following:
-
In the URL field, enter the full URL of your endpoint, including the host and port. For example, if your Flask app is running on http://localhost:5000 and the endpoint is /signup, the full URL would be http://localhost:5000/logout.
-
In the Headers section, add a key-value pair with the key Content-Type and the value application/json.
-
In Authorization tab, select the type of authorization you want to use, in this case, it is application secret key
-
Add the key in the value field of the authorization tab
-
Finally, click the Send button to make the POST request.
- This API should take “user_id” as a parameter.
- Only logged-in users can call this API.
- This should return all the vendor details with their store and item offerings.
- This API should be of the following structure
{
"item_id":"",
"item_name":"",
"calories_per_gm":0,
"available_quantity":0,
"restaurant_name":"",
"unit_price":0
}
- It list all the items in the inventory
- API for creating an item order
- input parameters:
{
"user_id":"",
"item_id":"",
"quantity":0
}
- Only logged-in customers can place orders.
- This API should take “order_id” as a parameter.
- Only logged-in users can call this API.
- This returns all the orders placed by that customer.
- This should take “customer_id” as a parameter.
- Only the admin can call this API.
- This API returns all the orders in the orders table.