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 Sales Reports API lets you create and manage sales reports for each Don Mamino bakery location. Each report captures the total sales figure for a given period and is automatically timestamped when created. The fecha_reporte field is set by the database at insert time and does not need to be provided in request bodies. All five endpoints require a valid JWT Bearer token.
Every endpoint on this page requires a valid JWT token. Include the token in the Authorization header as Bearer <token> on every request.

GET /api/reportes-ventas

Returns a list of all sales reports across all bakery locations. Auth required: Yes

Response fields

id_reporte
number
Unique identifier for the sales report.
fecha_reporte
string
Timestamp of when the report was created. Set automatically by the database (DATETIME DEFAULT CURRENT_TIMESTAMP). Format: YYYY-MM-DD HH:MM:SS.
total_ventas
number
Total sales amount for the reported period, as a decimal value (e.g., 1500.75).
id_sede
number
ID of the bakery location this report belongs to. References the Sedes table.
curl --request GET \
  --url http://localhost:3000/api/reportes-ventas \
  --header 'Authorization: Bearer <token>'
Example response
[
  {
    "id_reporte": 1,
    "fecha_reporte": "2026-05-01 09:00:00",
    "total_ventas": 3250.50,
    "id_sede": 1
  },
  {
    "id_reporte": 2,
    "fecha_reporte": "2026-05-01 09:15:00",
    "total_ventas": 1875.00,
    "id_sede": 2
  }
]

GET /api/reportes-ventas/:id

Returns a single sales report by its unique ID. Auth required: Yes

Path parameters

id
number
required
The id_reporte of the report to retrieve.

Response fields

id_reporte
number
Unique identifier for the sales report.
fecha_reporte
string
Timestamp of when the report was created. Format: YYYY-MM-DD HH:MM:SS.
total_ventas
number
Total sales amount for the reported period.
id_sede
number
ID of the bakery location this report belongs to.
curl --request GET \
  --url http://localhost:3000/api/reportes-ventas/1 \
  --header 'Authorization: Bearer <token>'
Example response
{
  "id_reporte": 1,
  "fecha_reporte": "2026-05-01 09:00:00",
  "total_ventas": 3250.50,
  "id_sede": 1
}

Error responses

StatusDescription
404No report found with the given ID. Response body: { "message": "Reporte no encontrado" }
500Internal server error.

POST /api/reportes-ventas

Creates a new sales report for a bakery location. The fecha_reporte timestamp is set automatically by the database. Auth required: Yes

Request body

total_ventas
number
required
Total sales amount for the period being reported. Accepts up to two decimal places (e.g., 1500.75).
id_sede
number
required
ID of the bakery location this report covers. Must reference an existing record in the Sedes table.

Response fields

id
number
The auto-generated id_reporte of the newly created report.
mensaje
string
Confirmation message: "Reporte creado exitosamente".
You do not need to provide fecha_reporte in the request body. The database sets it automatically to the current timestamp at the moment of insertion.
curl --request POST \
  --url http://localhost:3000/api/reportes-ventas \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "total_ventas": 2100.00,
    "id_sede": 1
  }'
Example response
{
  "id": 3,
  "mensaje": "Reporte creado exitosamente"
}

PUT /api/reportes-ventas/:id

Updates the total_ventas and id_sede fields of an existing sales report. Both body fields must be provided. Auth required: Yes

Path parameters

id
number
required
The id_reporte of the report to update.

Request body

total_ventas
number
required
Updated total sales amount.
id_sede
number
required
Updated bakery location ID for this report.

Response fields

mensaje
string
Confirmation message: "Reporte actualizado exitosamente".
curl --request PUT \
  --url http://localhost:3000/api/reportes-ventas/3 \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "total_ventas": 2350.00,
    "id_sede": 1
  }'
Example response
{
  "mensaje": "Reporte actualizado exitosamente"
}

Error responses

StatusDescription
404No report found with the given ID. Response body: { "message": "Reporte no encontrado" }
500Internal server error.

DELETE /api/reportes-ventas/:id

Permanently deletes a sales report. Auth required: Yes

Path parameters

id
number
required
The id_reporte of the report to delete.

Response fields

mensaje
string
Confirmation message: "Reporte eliminado exitosamente".
This action is permanent. Deleted sales reports cannot be recovered.
curl --request DELETE \
  --url http://localhost:3000/api/reportes-ventas/3 \
  --header 'Authorization: Bearer <token>'
Example response
{
  "mensaje": "Reporte eliminado exitosamente"
}

Error responses

StatusDescription
404No report found with the given ID. Response body: { "message": "Reporte no encontrado" }
500Internal server error.

Build docs developers (and LLMs) love