Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/luisllatas-dev/Proyecto_Pasteleria_DonMamino/llms.txt

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

The Orders API manages the full lifecycle of customer orders across Don Mamino’s bakery locations. Every endpoint — including read operations — requires a valid JWT Bearer token. Orders are assigned to a specific client (id_cliente), handled by a user (id_usuario), and fulfilled by a location (id_sede).
Authentication required: All endpoints on this resource require an Authorization: Bearer <token> header. Requests without a valid token will be rejected.
Order lifecycle: Orders progress through the following states in sequence:procesandoen preparaciónenviadoentregadoThe estado field defaults to procesando when a new order is created. Use PUT /api/pedidos/:id to advance an order through these stages.

GET /api/pedidos

Returns a list of all orders across all bakery locations.
curl --request GET \
  --url http://localhost:3000/api/pedidos \
  --header 'Authorization: Bearer <token>'
Response — 200 OK
[
  {
    "id_pedido": 1,
    "fecha_pedido": "2024-11-15T10:30:00.000Z",
    "estado": "entregado",
    "id_cliente": 2,
    "id_usuario": 1,
    "id_sede": 1
  },
  {
    "id_pedido": 2,
    "fecha_pedido": "2024-11-16T14:00:00.000Z",
    "estado": "procesando",
    "id_cliente": 5,
    "id_usuario": 3,
    "id_sede": 2
  }
]
id_pedido
number
required
Auto-incremented unique identifier for the order.
fecha_pedido
string
required
ISO 8601 datetime when the order was created. Set automatically by the database.
estado
string
required
Current status of the order. One of: procesando, en preparación, enviado, entregado.
id_cliente
number
required
ID of the client who placed the order. References the Clientes table.
id_usuario
number
required
ID of the user who processed the order. References the Usuarios table.
id_sede
number
required
ID of the bakery location that fulfilled the order. References the Sedes table.

GET /api/pedidos/:id

Returns a single order by its unique ID.
curl --request GET \
  --url http://localhost:3000/api/pedidos/1 \
  --header 'Authorization: Bearer <token>'
Response — 200 OK
{
  "id_pedido": 1,
  "fecha_pedido": "2024-11-15T10:30:00.000Z",
  "estado": "entregado",
  "id_cliente": 2,
  "id_usuario": 1,
  "id_sede": 1
}
Response — 404 Not Found
{
  "message": "Pedido no encontrado"
}

POST /api/pedidos

Creates a new order. The fecha_pedido field is set automatically by the database. The estado defaults to procesando if not provided.
estado
string
default:"procesando"
Initial status of the order. Must be one of: procesando, en preparación, enviado, entregado. Defaults to procesando.
id_cliente
number
required
ID of the client placing the order. Must reference an existing record in the Clientes table.
id_usuario
number
required
ID of the user managing the order. Must reference an existing record in the Usuarios table.
id_sede
number
required
ID of the bakery location handling the order. Must reference an existing record in the Sedes table.
curl --request POST \
  --url http://localhost:3000/api/pedidos \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "estado": "procesando",
    "id_cliente": 2,
    "id_usuario": 1,
    "id_sede": 1
  }'
Response — 201 Created
{
  "id": 3,
  "mensaje": "Pedido creado exitosamente"
}
id
number
required
The id_pedido of the newly created order.
mensaje
string
required
Confirmation message.

PUT /api/pedidos/:id

Updates all fields of an existing order. Use this endpoint to advance an order through the status lifecycle.
id
number
required
The unique ID of the order to update.
estado
string
required
New status for the order. Must be one of: procesando, en preparación, enviado, entregado.
id_cliente
number
required
ID of the client associated with the order.
id_usuario
number
required
ID of the user managing the order.
id_sede
number
required
ID of the bakery location handling the order.
curl --request PUT \
  --url http://localhost:3000/api/pedidos/3 \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "estado": "en preparación",
    "id_cliente": 2,
    "id_usuario": 1,
    "id_sede": 1
  }'
Response — 200 OK
{
  "mensaje": "Pedido actualizado exitosamente"
}
Response — 404 Not Found
{
  "message": "Pedido no encontrado"
}

DELETE /api/pedidos/:id

Permanently deletes an order by ID. Deleting an order also removes all associated Detalle_Pedido records due to the ON DELETE CASCADE constraint in the database.
Deleting an order is permanent and cascades to all associated order detail records. This action cannot be undone.
id
number
required
The unique ID of the order to delete.
curl --request DELETE \
  --url http://localhost:3000/api/pedidos/3 \
  --header 'Authorization: Bearer <token>'
Response — 200 OK
{
  "mensaje": "Pedido eliminado exitosamente"
}
Response — 404 Not Found
{
  "message": "Pedido no encontrado"
}

Build docs developers (and LLMs) love