Giter VIP home page Giter VIP logo

restaurante_api's Introduction

API_RESTAURANT

EMPLOYEES

GET GET_ALL_EMPLOYEES

/api/employees

Header

Bearer Token

Response

[
  {
    "id": 1,
    "name": "Joseph Climber",
    "login": "joseph",
    "is_admin": false,
    "cpf": "047222222222"
  },
  {
    "id": 2,
    "name": "Irineu Rodrigues",
    "login": "irineu",
    "is_admin": true,
    "cpf": "047333333333"
  }
]


GET GET_EMPLOYEE

/api/employees/<employee_id: int>

Header

Bearer Token

Response

{
  "id": 1,
  "name": "Joseph Climber",
  "login": "joseph",
  "is_admin": false,
  "cpf": "047222222222"
}


POST CREATE_EMPLOYEE

/api/employees

Header

Bearer Token

Body

{
  "name": "Joseph Climber",
  "login": "joseph",
  "password": "123456",
  "is_admin": false,
  "cpf": "047222222222"
}

Response

{
  "id": 1,
  "name": "Joseph Climber",
  "login": "joseph",
  "is_admin": false,
  "cpf": "047222222222"
}


POST LOGIN_EMPLOYEE

/api/employees/login

Header


Body

{
  "login": "joseph",
  "password": "123456"
}

Response

{
  "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmcmVzaCI6ZmFsc2UsImlhdCI6MTYyNjQ0MjgzMywianRpIjoiMTE5MGM5OGQtYTI1Mi00ZjdlLWE3ZWYtOWNkYjA0OTUzYjI3IiwidHlwZSI6ImFjY2VzcyIsInN1YiI6eyJpZCI6MiwibmFtZSI6ImlsbGlhbiIsImxvZ2luIjoiaWxsaWFuIiwiY3BmIjoiMDAwMDAwMDAwMDAiLCJpc19hZG1pbiI6ZmFsc2V9LCJuYmYiOjE2MjY0NDI4MzMsImV4cCI6MTYyNjQ0NjQzM30.pp94uopkA-HjiwvLTQXbGPQv587yHljHpW-27MBkBAE"
}


PATCH UPDATE_EMPLOYEE

/api/employees/<employee_id: int>

Header

Bearer Token

Body

{
  "name": "Joseph Rodrigues"
}

Response

{
  "id": 1,
  "name": "Joseph Rodrigues",
  "login": "joseph",
  "is_admin": false,
  "cpf": "047222222222"
}



DELETE DELETE_EMPLOYEE

/api/employees/<employee_id: int>

Header

Bearer Token

Response

""



USERS


GET GET_ALL_USERS

/api/users

Header

Bearer Token

Response

[
  {
    "id": 1,
    "name": "Joseph Climber",
    "cpf": "047222222222",
    "total_spent": 345.22
  },
  {
    "id": 2,
    "name": "Irineu Cleber",
    "cpf": "047333333333",
    "total_spent": 57.48
  }
]


GET GET_USER

/api/users/<user_id:int>

Header

Bearer Token

Response

{
  "id": 1,
  "name": "Joseph Climber",
  "cpf": "047222222222",
  "total_spent": 345.22
}


POST CREATE_USER

/api/users

Header

Bearer Token

Body

{
  "name": "Joseph Climber",
  "cpf": "047222222222"
}

Response

{
  "id": 1,
  "name": "Joseph Climber",
  "cpf": "047222222222",
  "total_spent": 0
}


GET GET_USER BY QUERY PARAM

/api/users?cpf=<cpf: str>&name=<name: str>

Header

Bearer Token

Response

{
  "id": 1,
  "name": "Joseph Climber",
  "cpf": "047222222222",
  "total_spent": 345.22
}


PATCH UPDATE_USER

/api/users/<user_id: int>

Header

Bearer Token

Body

{
  "name": "Joseph Rodrigues",
  "total_spent": 522.35
}

Response

{
  "id": 1,
  "name": "Joseph Rodrigues",
  "cpf": "047222222222",
  "total_spent": 522.35
}



TABLES


GET GET_ALL_TABLES

/api/tables

Header

Bearer Token

Response

[
  {
    "id": 1,
    "login": "table01",
    "number": 1,
    "seats": 6,
    "user": {
      "id": 1,
      "name": "Joseph Climber",
      "cpf": "047222222222",
      "total_spent": 522.35
    },
    "total": 127.48,
    "empty": false,
    "orders_list": "/api/orders/1"
  },
  {
    "id": 2,
    "number": 1,
    "seats": 6,
    "user": {},
    "total": 127.48,
    "empty": true,
    "orders_list": "/api/orders/2"
  }
]


GET GET_TABLE

/api/tables/table_id=<table_id: int>

Header

Bearer Token

Response

{
  "id": 1,
  "login": "table01",
  "number": 1,
  "seats": 6,
  "user": {
    "id": 1,
    "name": "Joseph Climber",
    "cpf": "047222222222",
    "total_spent": 522.35
  },
  "total": 127.48,
  "empty": false,
  "orders_list": "/api/orders/1"
}


GET GET_TABLE BY QUERY PARAM

/api/tables?empty=<empty: bool>&number=<number: int>

Header

Bearer Token

Response

{
  "id": 1,
  "login": "table01",
  "number": 1,
  "seats": 6,
  "user": {
    "id": 1,
    "name": "Joseph Climber",
    "cpf": "047222222222",
    "total_spent": 522.35
  },
  "total": 127.48,
  "empty": false,
  "orders_list": "/api/orders/1"
}


POST CREATE_TABLE

/api/tables

Header

Bearer Token

Body

{
  "login": "table01",
  "password": "table01",
  "number": 1,
  "seats": 6
}

Response

{
  "id": 1,
  "login": "table01",
  "number": 1,
  "seats": 6,
  "empty": true
}


PATCH UPDATE_TABLE

/api/tables/<table_id: int>

Header

Bearer Token

Body

{
  "number": 2,
  "seats": 4
}

Response

{
  "id": 1,
  "login": "table01",
  "number": 2,
  "seats": 4,
  "user": {
    "id": 1,
    "name": "Joseph Climber",
    "cpf": "047222222222",
    "total_spent": 522.35
  },
  "total": 127.48,
  "empty": false,
  "orders_list": "/api/orders/1"
}


PATCH PAY_BILL

/api/tables/paybill/<table_id: int>

Header

Bearer Token

Body

empty

Response

{
  "Total without discount": 140.0,
  "Total with discount": 112.0
}


DELETE DELETE_TABLE

/api/tables/<table_id: int>

Header

Bearer Token

Response

"";


POST LOGIN_TABLE

/api/tables/login

Header


Body

{
  "login": "Irineu",
  "password": "12345"
}

Response

{
  "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmcmVzaCI6ZmFsc2UsImlhdCI6MTYyNjIxNDA3NSwianRpIjoiMWJjMDE5ZTktNzY2OS00MzJmLWJhMDctMzE0MjgxZTg0ODU5IiwidHlwZSI6ImFjY2VzcyIsInN1YiI6eyJpZCI6MiwibmFtZSI6Ikx1Y2FzIEpvc2Vmb3ZpY3oiLCJsb2dpbiI6Imx1Y2FzIn0sIm5iZiI6MTYyNjIxNDA3NSwiZXhwIjoxNjI2MjE0OTc1fQ.Mj5yzf4ENLntgmnTs8Hvlvwqa_FI_T1fh_1uQiKy6fU"
}



ORDERS


GET GET_ALL_ORDERS

/api/orders

Header

Bearer Token

Response

[
    {
        "id": 1,
        "date": ,//decidir formato da data
        "table_number": 5,
        "cooking": false,
        "ready": false,
        "delivered": false,
        "paid": false,
        "products": [
                        {
                            "id": 1,
                            "name": "Risoto Carbonara",
                            "quantity": 2,
                            "price": 7.80
                        },
                        {
                            "id": 3,
                            "name": "Fettuccine com molho Marzano",
                            "quantity": 1,
                            "price": 15.00
                        }
                    ],
        "total_products": 30.60
    },
    {
        "id": 2,
        "date": ,//decidir formato da data
        "table_number": 3,
        "cooking": true,
        "ready": false,
        "delivered": false,
        "paid": false,
        "products": [
                        {
                            "id": 4,
                            "name": "Raviolli de Ricota",
                            "quantity": 1,
                            "price": 10.00
                        }
                    ],
        "total_products": 10.00
    }
]


GET GET_ORDER

/api/orders/<table_id: int>

Header

Bearer Token

Response

[
    {
        "id": 1,
        "date": ,//decidir formato da data
        "table_number": 5,
        "cooking": false,
        "ready": false,
        "delivered": false,
        "products": [
                        {
                            "id": 1,
                            "name": "Risoto Carbonara",
                            "quantity": 2,
                            "price": 7.80
                        },
                        {
                            "id": 3,
                            "name": "Fettuccine com molho Marzano",
                            "quantity": 1,
                            "price": 15.00
                        }
                    ],
        "total_products": 30.60
    }
]


GET GETORDERS BY QUERY PARAMS

/api/orders?table_id=<table_id: int>?&ready=<ready: bool>&paid=<paid: bool>

Header

Bearer Token

Response

[
    {
        "id": 1,
        "date": ,//decidir formato da data
        "table_number": 5,
        "cooking": false,
        "ready": false,
        "delivered": false,
        "products": [
                        {
                            "id": 1,
                            "name": "Risoto Carbonara",
                            "quantity": 2,
                            "price": 7.80
                        },
                        {
                            "id": 3,
                            "name": "Fettuccine com molho Marzano",
                            "quantity": 1,
                            "price": 15.00
                        }
                    ],
        "total_products": 30.60
    }
]


POST CREATE_ORDER

/api/orders

Header

Bearer Token

Body

{
  "date": "Timestamp -> Unix", //decidir formato da data
  "table_id": 5,
  "products": [1, 2, 3, 1]
}

Response

{
    "id": 1,
    "date": ,//decidir formato da data
    "table_number": 5,
    "cooking": false,
    "ready": false,
    "delivered": false,
    "products": [
                    {
                        "id": 1,
                        "name": "Risoto Carbonara",
                        "quantity": 2,
                        "price": 7.80
                    },
                    {
                        "id": 3,
                        "name": "Fettuccine com molho Marzano",
                        "quantity": 1,
                        "price": 15.00
                    }
                ],
    "total_products": 30.60
}


PATCH UPDATE_ORDER

/api/orders/<order_id: int>

Header

Bearer Token

Body

{
  "cooking": false,
  "ready": true,
  "delivered": false
}

Response

[
    {
        "id": 1,
        "date": ,//decidir formato da data
        "table_number": 5,
        "cooking": false,
        "ready": true,
        "delivered": false,
        "products": [
                        {
                            "id": 1,
                            "name": "Risoto Carbonara",
                            "quantity": 2,
                            "price": 7.80
                        },
                        {
                            "id": 3,
                            "name": "Fettuccine com molho Marzano",
                            "quantity": 1,
                            "price": 15.00
                        }
                    ],
        "total_products": 30.60
    }
]


DELETE DELETE_ORDER

/api/orders/<order_id: int>

Header

Bearer Token

Response

"";



PRODUCTS


GET GET_ALL_PRODUCTS

/api/products

Header

Bearer Token

Response

[
  {
    "id": 1,
    "name": "Risoto Carbonara",
    "section": "Pratos principais",
    "price": 7.8,
    "calories": 587.87
  },
  {
    "id": 3,
    "name": "Fettuccine com molho Marzano",
    "section": "Pratos principais",
    "price": 15.0,
    "calories": 635.22
  }
]


GET GET_PRODUCT

/api/products/<product_id: int>

Header

Bearer Token

Response

{
  "id": 1,
  "name": "Risoto Carbonara",
  "section": "Pratos principais",
  "price": 7.8,
  "calories": 587.87
}


GET GET_PRODUCTS BY QUERY PARAM

/api/products?section=<section: bool>?veggie=<veggie: bool>

Header

Bearer Token

Response

[
  {
    "id": 1,
    "name": "Risoto Carbonara",
    "section": "Pratos principais",
    "price": 7.8,
    "calories": 587.87
  },
  {
    "id": 3,
    "name": "Fettuccine com molho Marzano",
    "section": "Pratos principais",
    "price": 15.0,
    "calories": 635.22
  }
]


POST CREATE_PRODUCT

/api/products

Header

Bearer Token

Body

{
  "name": "Risoto Carbonara",
  "price": 7.8,
  "calories": 587.87
}

Response

{
  "id": 1,
  "name": "Risoto Carbonara",
  "section": "None",
  "price": 7.8,
  "calories": 587.87
}


PATCH UPDATE_PRODUCT

/api/products/<product_id: int>

Header

Bearer Token

Body

{
  "price": 18.8
}

Response

{
  "id": 1,
  "name": "Risoto Carbonara",
  "section": "None",
  "price": 18.8,
  "calories": 587.87
}


DELETE UPDATE_PRODUCT

/api/products/<product_id: int>

Header

Bearer Token

Response

"";


restaurante_api's People

Contributors

renansampaio04 avatar lucianofeder avatar illiancurvelloferreira avatar junianunes avatar nuclearigor avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.