Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Little Lemon Menu API

A simple REST API for managing restaurant menu items and categories, built with Django REST Framework.

Features

  • RESTful API endpoints
  • View all menu items
  • Add a new menu item
  • View all categories
  • Add a new category
  • Category and menu item relationship
  • Pagination
  • Ordering by price and inventory
  • Search by category
  • Data validation with serializers
  • JSON and XML response formats
  • Browsable API interface
  • Token authentication with Djoser
  • User registration and login
  • Manager group management
  • Delivery crew group management
  • Cart API
  • Orders API
  • Automatic cart price calculation
  • Order assignment and delivery status updates

Tech Stack

  • Python
  • Django
  • Django REST Framework
  • djangorestframework-xml
  • SQLite
  • Djoser
  • Token Authentication

API Endpoints

Method Endpoint Description
POST /auth/users/ Register a new user
POST /auth/token/login/ Login and get token
POST /auth/token/logout/ Logout user
GET /api/groups/manager/users/ View manager users
POST /api/groups/manager/users/ Add user to Manager group
GET /api/groups/delivery-crew/users/ View delivery crew users
POST /api/groups/delivery-crew/users/ Add user to Delivery crew group
GET /api/cart/menu-items/ View current user's cart
POST /api/cart/menu-items/ Add item to cart
DELETE /api/cart/menu-items/ Clear cart
GET /api/orders/ View orders
POST /api/orders/ Create order
GET /api/orders/{id}/ View single order
PATCH /api/orders/{id}/ Update order status or assign delivery crew

Query Options

Pagination

Menu items are paginated.

Example:

/api/menu-items/?page=2

Ordering

You can order menu items by price or inventory.

/api/menu-items/?ordering=price
/api/menu-items/?ordering=-price
/api/menu-items/?ordering=inventory
/api/menu-items/?ordering=-inventory

Search

You can search menu items by category title.

/api/menu-items/?search=Desserts

Validation Rules

  • price must be at least 2
  • inventory must be at least 0

Example Category

{
  "slug": "desserts",
  "title": "Desserts"
}

Example Menu Item

{
  "title": "Grilled Fish",
  "price": "8.50",
  "inventory": 20,
  "category_id": 3
}

Example Response

{
  "id": 1,
  "title": "Grilled Fish",
  "price": "8.50",
  "inventory": 20,
  "category": {
    "id": 3,
    "title": "Appetizers"
  }
}

Cart Example

Request

{
  "menuitem": 1,
  "quantity": 2
}

## Example Response

```json
{
  "id": 1,
  "user": 1,
  "menuitem": 1,
  "quantity": 2,
  "unit_price": "6.00",
  "price": "12.00"
}

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages