Welcome to RestaurantAPI project, a Django and DRF project designed to streamline restaurant operations through a comprehensive API. This project offers a robust solution for managing menu items, processing orders, and organizing user groups within a restaurant ecosystem.
In RestaurantAPI, we embrace a structured approach to user management, catering to the diverse roles and responsibilities within a restaurant setting. Our project revolves around three primary user groups, each tailored to fulfill specific functions:
-
Manager: Managers oversee the day-to-day operations, including menu management, order tracking, and staff status.
-
Delivery Crew: The delivery crew is responsible for order delivery logistics, ensuring timely and efficient distribution of orders to customers.
-
Customer: Customers interact with the system to browse the menu, place orders, and track their order status.
Each user group is equipped with tailored permissions and privileges to ensure smooth operations and maintain security standards throughout the platform.
Furthermore, new users who register on the platform are automatically assigned the customer role through a signal. This simplifies the onboarding process, ensuring that all new users have access to basic functionalities upon registration.
To start using RestaurantAPI, follow these simple steps:
- Clone the Repository: Use the following command to clone the repository to your local machine:
git clone https://github.com/t7spotter/restaurantAPI.git
Navigate to restaurantAPI folder:
cd restaurantAPI
And run the project, you can use Docker with docker-compose up to create new container with this app.
docker-compose up --build
GET /api/menu-items
GET /api/menu-items/<menu_item_id>
POST /api/menu-items
Example request body:
{
"title": "New Item",
"price": 9.99,
"featured": true,
"category": "Category ID"
}
PUT /api/menu-items/<menu_item_id>
Example request body:
{
"title": "Updated Item",
"price": 12.99,
"featured": false,
"category": "New Category ID"
}
DELETE /api/menu-items/<menu_item_id>
GET /api/category
GET /api/category/<category_id>
POST /api/category
Example request body:
{
"slug": "new-category",
"title": "New Category"
}
PUT /api/category/<category_id>
Example request body:
{
"slug": "updated-category",
"title": "Updated Category"
}
DELETE /api/category/<category_id>
POST /api/groups/manager/users
Example request body:
{
"username": "username"
}
DELETE /api/groups/manager/users/<user_id>
POST /api/groups/delivery-crew/users
Example request body:
{
"username": "username"
}
DELETE /api/groups/delivery-crew/users/<user_id>
GET /api/cart/menu-items
POST /api/cart/menu-items
Example request body:
{
"menuitem": "menu_item_id",
"quantity": 2
}
DELETE /api/cart/menu-items
GET /api/orders
GET /api/orders/<order_id>
POST /api/orders
POST /api/delivery/<order_id>
Get Orders Assigned to Delivery Crew (each delivery crew user only can check orders which assigned to them not for another delivery crew users)
GET /api/delivery
Update Delivery Status of an Order by Delivery Crew (each delivery crew user only can change the status "delivered" orders which assigned to them not for another delivery crew users)
POST /api/delivery/<order_id>
GET /api/undelivered
POST /api/undelivered/<order_id>
GET /api/delivered
Replace <menu_item_id>
, <category_id>
, <user_id>
, and <order_id>
with actual IDs when making requests.
New users can register by making a POST request to the following endpoint:
POST /auth/users/
The request body should include two required fields:
{
"username": "username",
"password": "password"
}
new users who register on the platform are automatically assigned the 'customer' role through a signal. This simplifies the onboarding process, ensuring that all new users have access to basic functionalities upon registration.
This API provides endpoints to retrieve sale reports based on specific dates.
Returns the sales report for today and amount of orders.
- Response:
{
"message": "Today (2024-05-01 13:35:02) sale is 137 for 7 orders."
}
- Body:
{
"start_date": "2023-4-27",
"end_date": "2024-05-01"
}
** If you omit the end_date
, the API calculates the sales from the start_date
to today.
** If you omit both the end_date
and start_date
, the API calculates the sales for today only.~~~~
- Response:
{
"message": "Your sale from 2023-4-27 to 2024-05-01 is 2438 for 73 orders."
}
This API provides access for users to rate an item if they have ordered that item at least once.
It Shows Menu items with rates counts and rates averages.
[
{
"id": 1,
"title": "Vanilla",
"category": 5,
"_category_title": "Ice creams",
"price": "3.00",
"featured": true,
"rate": {
"rate_count": 246,
"rate_average": 8.9
}
},
{
"id": 2,
"title": "Chocolate",
"category": 5,
"_category_title": "Ice creams",
"price": "4.00",
"featured": false,
"rate": {
"rate_count": 325,
"rate_average": 8.74
}
},
{
"id": 3,
"title": "Mango",
"category": 5,
"_category_title": "Ice creams",
"price": "7.00",
"featured": true,
"rate": {
"rate_count": 436,
"rate_average": 9.14
}
},
.
.
.
]
Customers can submit a rating between 1 and 10 (just integer) in JSON format:
{
"rate": 9
}
users can get, add and remove their own addresses from profile
GET /address
POST /address
DELETE /address/<int:address_id>
Feel free to contribute to this project by submitting pull requests or reporting issues.