Business Menus Model

Action

Method

Resource

Description

Get all

GET

/business/:business_id/menus

Get all menus with business_id.

Get

GET

/business/:business_id/menus/:menu_id

Get menu with id business_id and menu_id.

Create

POST

/business/:business_id/menus

Create a menu with business_id.

Update

PUT

/business/:business_id/menus/:menu_id

Update menu with business_id and menu_id.

Delete

DELETE

/business/:business_id/menus/:menu_id

Delete menu with business_id and menu_id.

The menu model is composed of the following attributes:

Attribute

Type

Required

Description

Whereable

name

string

no, required to create.

The menu's name.

Yes

comment

string

no

The menu's comment.

Yes

schedule

json

no, required to create.

The menu's schedule. More about schedules

No

pickup

boolean

no, required to create.

The menu's pickup.

Yes

delivery

boolean

no, required to create.

The menu's delivery.

Yes

eatin

boolean

no

The menu's eat in.

Yes

products

json

no

The menu's products. is an array with the products id ex. [3,24,35,46,...]

No

enabled

boolean

no

The menu's status.

Yes

📘

Restrictions for POST, PUT and DELETE menu.

Business menus can only be created, updated or removed by users level 0 (Type: Administrator) and user level 2 (Type: Business owner).

  • User type Administrator can create, update or remove any business menu from any business.
  • User Type Business owner can create, update or remove only business menus related to his business.

📘

GET responses for business menus.

In general, there is no restriction to obtain business menus but there are to paths to obtain it, data obtained depends on the type of user.

  • Normal.
  • mode:dashboard.

Therefore, depending on the mode and the type of user, the response will be obtained as shown below:

  • User type Administrator and mode:dashboard can get all business menus.
  • User type Business owner and mode:dashboard can obtain business menus related to his business.
  • Users type Customer can obtain all business menus bounded by the business they can get and if businesses menu are enable for his request. This is a compared example:

Note: mode:dashboard only can be used by used by user level 0 or 2. Any user without mode:dashboard make a request as user type customer (level 3).

{
    "error": false,
    "result": [
        {
            "id": 8,
            "business_id": 7,
            "name": "Delivery Menu",
            "comment": "Thanks!",
            "schedule": [...],
            "pickup": true,
            "delivery": true,
            "enabled": true,
            "products": [
                {
                    "id": 475,
                    "name": "Take Up Trousers",
                    "price": 14,
                    "description": "",
                    "images": "https://res.cloudinary.com/ordering/image/upload/v1490664570/hy90ae5toz13lkdle4a3.jpg",
                    "sku": null,
                    "category_id": 102,
                    "inventoried": false,
                    "quantity": 0,
                    "featured": false,
                    "enabled": true,
                    "pivot": {
                        "menu_id": 8,
                        "product_id": 475
                    }
                },
                ...
            ]
        }
        ... //(All enabled menus)
    ]
}
{
    "error": false,
    "result": [
        {
            "id": 8,
            "business_id": 7,
            "name": "Delivery Menu",
            "comment": "Thanks!",
            "schedule": [...],
            "pickup": true,
            "delivery": true,
            "enabled": false,
            "products": [
                {
                    "id": 475,
                    "name": "Take Up Trousers",
                    "price": 14,
                    "description": "",
                    "images": "https://res.cloudinary.com/ordering/image/upload/v1490664570/hy90ae5toz13lkdle4a3.jpg",
                    "sku": null,
                    "category_id": 102,
                    "inventoried": false,
                    "quantity": 0,
                    "featured": false,
                    "enabled": true,
                    "pivot": {
                        "menu_id": 8,
                        "product_id": 475
                    }
                },
                ...
            ]
        }
        ... //(All menus including disabled)
    ]
}