Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/fredy-rizo/MultiSas/llms.txt

Use this file to discover all available pages before exploring further.

A pedido (order) is created each time a customer places a food or beverage order at your restaurant’s point of sale. When an order is recorded, the API auto-generates a sequential bill counter (bill_counter), stamps the current date and time, and snapshots the ordered product along with all its extras. The two endpoints below let you create a new order and list all orders for a company with pagination.
All order endpoints require two authentication middlewares. TokenAny validates the bearer token and attaches the user to the request. TokenAuthorize('Admin', 'Super Admin') restricts access to users whose role is either Admin or Super Admin. Include the token in every request as token-access: Bearer $TOKEN.

Create an Order


POST /api/pedido/restaurante/:company_id/:product_id Creates a new restaurant order. The server looks up the product and company by their IDs, auto-generates the bill_counter, and saves the price snapshot.

Path Parameters

company_id
string
required
The MongoDB ObjectId of the owning company (tenant).
product_id
string
required
The MongoDB ObjectId of the product being ordered.

Body Parameters

price_pedido
string
required
The total price charged for this order (stored as a string, e.g. "28000").

Response Fields

msj
string
Human-readable result message.
status
boolean
true on success, false on failure.
save_pedido_restaurante
object
The newly created order document.

Example

curl -X POST https://api.example.com/api/pedido/restaurante/64a1f2c3e4b0a1b2c3d4e5f6/64c3f4e5a6b7c8d9e0f1a2b3 \
  -H "Content-Type: application/json" \
  -H "token-access: Bearer $TOKEN" \
  -d '{
    "price_pedido": "28000"
  }'
{
  "msj": "Nuevo pedido registrado exitosamente en restaurante",
  "status": true,
  "save_pedido_restaurante": {
    "_id": "64e5f6a7b8c9d0e1f2a3b4c5",
    "bill_counter": "PED-0001",
    "date_pedido": "1/15/2024",
    "hour_pedido": "12:35:00 PM",
    "price_pedido": "28000",
    "product": {
      "_id": "64c3f4e5a6b7c8d9e0f1a2b3",
      "name_product": "Bandeja Paisa",
      "description_product": "Plato típico colombiano",
      "price_product": "28000",
      "extras": [
        { "_id": "64c3f4e5a6b7c8d9e0f1a2b4", "name_extra": "Aguacate", "price_extra": "2000" }
      ]
    },
    "company": {
      "_id": "64a1f2c3e4b0a1b2c3d4e5f6",
      "name_company": "Restaurante El Sabor",
      "name_founder": "Juan Pérez",
      "nit_company": "900123456-7"
    },
    "createdAt": "2024-01-15T17:35:00.000Z",
    "updatedAt": "2024-01-15T17:35:00.000Z"
  }
}

List Orders


GET /api/pedido/restaurante/:company_id/:pag?/:perpage? Returns a paginated list of all orders for the specified company, sorted by most recently created. The optional :pag and :perpage path segments are processed by the Paginate middleware and control the page offset and page size.

Path Parameters

company_id
string
required
The MongoDB ObjectId of the company whose orders to retrieve.
pag
number
Optional page number. Defaults to page 1 if omitted.
perpage
number
Optional number of results per page. Defaults to the middleware default if omitted.

Response Fields

msj
string
Human-readable result message.
status
boolean
true on success.
data
array
Array of order documents for the company.
pagination
object
Pagination metadata.

Example

curl -X GET https://api.example.com/api/pedido/restaurante/64a1f2c3e4b0a1b2c3d4e5f6/1/10 \
  -H "Content-Type: application/json" \
  -H "token-access: Bearer $TOKEN"
{
  "msj": "Cargando todos los pedidos",
  "status": true,
  "data": [
    {
      "_id": "64e5f6a7b8c9d0e1f2a3b4c5",
      "bill_counter": "PED-0001",
      "date_pedido": "1/15/2024",
      "hour_pedido": "12:35:00 PM",
      "price_pedido": "28000",
      "product": {
        "_id": "64c3f4e5a6b7c8d9e0f1a2b3",
        "name_product": "Bandeja Paisa",
        "description_product": "Plato típico colombiano",
        "price_product": "28000",
        "extras": []
      },
      "company": {
        "_id": "64a1f2c3e4b0a1b2c3d4e5f6",
        "name_company": "Restaurante El Sabor",
        "name_founder": "Juan Pérez",
        "nit_company": "900123456-7"
      },
      "createdAt": "2024-01-15T17:35:00.000Z",
      "updatedAt": "2024-01-15T17:35:00.000Z"
    }
  ],
  "pagination": {
    "pag": "1",
    "perpage": 10,
    "pags": 1
  }
}

Build docs developers (and LLMs) love