Tsygankov-Slava / pizza-sales

Prototype of a pizza selling website for lad academy.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pizza sales

Prototype of a pizza selling website for lad academy.
The stack used: PHP/Laravel, MySQL.

GitHub license

Table of contents

Documentation

Architecture

🔝Table of contents

Possible actions for roles

🔝Table of contents

Database

🔝Table of contents

REST API

Authorization REST API

POST /register

Request body: 
{
    name, mail, phone, birthdate
}

Response:
- 201, {id} // OK
- 400 // Error
- 500 // Unexpected error
{
    error_message: $message
}
POST /login

Request body: 
{
    login, password
}

Response:
- 200, {token, expiration} // OK
- 400 // Error
- 500 // Unexpected error
{
    error_message: $message
}

Administration REST API

GET /order?status=active/complete/denied

Header:
- x-auth-token: $token

Response:
- 200 // OK
- 400 // Error
- 401 // Access denied
- 403 // Forbidden 
- 500 // Unexpected error

Response body:
{
  orders: [
    {
        id, 
        payment_method, 
        delivery_method, 
        comment, 
        address, 
        status, 
        timestamp_create, 
        timestamp_accept_deny,
        items: [
            id,
            quantity,
            price,
            menu_item: {
                title,
                description,
                price,
                image
            }
        ]        
    }
      ]
      page_current: 0,
      page_count: 10
}
POST /order/${id}

Header:
- x-auth-token: $token

Request body: 
{
    order_action: deny/accept/complete
}

Response:
- 200 // OK
- 400 // Error
- 401 // Access denied
- 403 // Forbidden 
- 404 // The order doesn't exist
- 500 // Unexpected error

Responce body:
{
    id, 
    payment_method, 
    delivery_method, 
    comment, 
    address, 
    status, 
    timestamp_create, 
    timestamp_accept_deny,
    items: [
        id,
        quantity,
        price,
        menu_item: {
            title,
            description,
            price,
            image
        }
    ]        
}

Customer REST API

GET /menu

Header:
- x-auth-token: $token

Response:
- 200 // OK
- 401 // Access denied
- 400 // Error
- 500 // Unexpected error

Response Body:
{
    menu: [
        {
            id, 
            title,
            description,
            price,
            image,
            timestamp    
        }
    ]
    page_current: 0,
    page_count: 10
}
GET /menu/${id}

Header:
- x-auth-token: $token

Response:
- 200 // OK
- 401 // Access denied
- 400 // Error
- 500 // Unexpected error

Response Body:
{
    item: {
            id, 
            title,
            description,
            price,
            image,
            category,
            composition,
            calories,
            timestamp    
        }
    page_current: 0,
    page_count: 10
}
GET /orders

Header:
- x-auth-token: $token

Response:
- 200 // OK
- 401 // Access denied
- 400 // Error
- 500 // Unexpected error

Response Body:
{
    orders: [
        {
            id, 
            payment_method, 
            delivery_method, 
            comment, 
            address, 
            status, 
            timestamp_create, 
            timestamp_accept_deny,
            items: [
                id,
                quantity,
                price,
                menu_item: {
                    title,
                    description,
                    price,
                    image
                }
            ]        
        }
    ]
    page_current: 0,
    page_count: 10
}
GET /orders/${id}

Header:
- x-auth-token: $token

Response:
- 200 // OK
- 400 // Error
- 401 // Access denied
- 404 // The order doesn't exist
- 500 // Unexpected error

Response Body:
{
    id, 
    payment_method, 
    delivery_method, 
    comment, 
    address, 
    status, 
    timestamp_create, 
    timestamp_accept_deny,
    items: [
        id,
        quantity,
        price,
        menu_item: {
            title,
            description,
            price,
            image
        }
    ]        
}
GET /basket

Header:
- x-auth-token: $token

Response:
- 200 // OK
- 401 // Access denied
- 400 // Error
- 500 // Unexpected error

Response Body:
{
    orders: [
        {
            id, 
            payment_method, 
            delivery_method, 
            comment, 
            address, 
            status, 
            timestamp_create, 
            timestamp_accept_deny,
            items: [
                id,
                quantity,
                price,
                menu_item: {
                    title,
                    description,
                    price,
                    image
                }
            ]        
        }
    ]
    page_current: 0,
    page_count: 10
}
GET /basket-add/${id}

Header:
- x-auth-token: $token

Response:
- 201 // OK
- 400 // Error
- 401 // Access denied
- 404 // The order doesn't exist
- 500 // Unexpected error

Response Body:
{
    id, 
    basket_id,
    menu_item_id,
    timestamp       
}
POST /basket/order-add

Header:
- x-auth-token: $token

Response:
- 201 // OK
- 400 // Error
- 401 // Access denied
- 404 // The order doesn't exist
- 500 // Unexpected error

Request body: 
{
    payment_method, delivery_method, comment, address, 
    items: [
        quantity,
        price,
        menu_item: {
            title,
            description,
            price,
            image
        }
    ]    
}
GET /basket-delete/${id}

Header:
- x-auth-token: $token

Response:
- 200 // OK
- 400 // Error
- 401 // Access denied
- 404 // The order doesn't exist
- 500 // Unexpected error

Request Body:
{
    basket_id,
    menu_item_id,    
}
GET /logout

Header:
- x-auth-token: $token

Response:
- 200 // OK
- 500 // Unexpected error

🔝Table of contents

Structure of project

Models

pizza-sales
|-app
  |-Models

Views

pizza-sales
|-resources
  |-views
    |-includes
    |-layouts

Controllers

pizza-sales
|-app
  |-Http
    |-Controllers

Routes

pizza-sales
|-routes
  |-web.php

Databases

pizza-sales
|-database
  |-migrations

🔝Table of contents

Demonstration of the work

Registration

Login

Add products to basket

Create the order

End the current session (Exit)

🔝Table of contents

License

pizza-sales is distributed under the MIT License, on behalf of Tsygankov Viacheslav.

🔝Table of contents

About

Prototype of a pizza selling website for lad academy.

License:MIT License


Languages

Language:PHP 84.4%Language:Blade 15.4%Language:JavaScript 0.2%Language:CSS 0.0%