Prototype of a pizza selling website for lad academy.
The stack used: PHP/Laravel, MySQL.
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
}
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
}
]
}
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
pizza-sales
|-app
|-Models
pizza-sales
|-resources
|-views
|-includes
|-layouts
pizza-sales
|-app
|-Http
|-Controllers
pizza-sales
|-routes
|-web.php
pizza-sales
|-database
|-migrations
pizza-sales
is distributed under the MIT License, on behalf of Tsygankov Viacheslav.