Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/akibanks/tienda_musica_web/llms.txt

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

The admin sales endpoints give administrators full visibility into every order placed through VinylVibes. Admins can list all sales across all users, inspect individual order details including line items and shipping addresses, and move orders through their lifecycle from pendiente to entregada. All three endpoints require a valid JWT from an account with the admin role.

GET /admin/ventas

Authentication: Required — admin JWT Returns all orders across all users. This is the data source for the admin panel’s sales table, the pending-orders stat card, and the total revenue calculation. The frontend computes total revenue by summing each order’s total, and counts pending orders by filtering for estado === 'pendiente'.

cURL Example

curl https://api-tienda-vinilos.onrender.com/admin/ventas \
  -H 'Authorization: Bearer <admin_token>'

Response

Returns an array of order summary objects.
id_venta
integer
Unique order ID.
cliente
object
Basic information about the buyer who placed the order.
estado
string
Current order status. One of: pendiente, pagada, enviada, entregada, or cancelada.
total
string
Order total as a decimal string (e.g., "89.97").
fecha
string
ISO 8601 timestamp of when the order was placed.

Response Example

[
  {
    "id_venta": 42,
    "cliente": { "nombre": "cliente_123" },
    "estado": "pendiente",
    "total": "89.97",
    "fecha": "2025-05-20T14:23:00Z"
  }
]

Stats Calculation

The admin panel derives its summary cards from this endpoint’s response:
document.getElementById('stat-ventas').textContent     = ventas.length;
document.getElementById('stat-pendientes').textContent = ventas.filter(v => v.estado === 'pendiente').length;
const ingresos = ventas.reduce((s, v) => s + Number(v.total), 0);
document.getElementById('stat-ingresos').textContent   = `$${ingresos.toFixed(2)}`;

GET /admin/ventas/{id}

Authentication: Required — admin JWT Returns the full detail for a single order, including its complete list of purchased vinyl records and the shipping address provided at checkout. The admin panel calls this endpoint when an admin clicks “Ver detalle” in the sales table.

Path Parameter

ParameterTypeDescription
idintegerOrder ID

cURL Example

curl https://api-tienda-vinilos.onrender.com/admin/ventas/42 \
  -H 'Authorization: Bearer <admin_token>'

Response

id_venta
integer
Unique order ID.
cliente
object
Basic information about the buyer.
estado
string
Current order status.
total
string
Order total as a decimal string.
fecha
string
ISO 8601 creation timestamp.
lineas
array
Array of vinyl records included in the order.
envio
object
Shipping address provided at checkout.

PUT /admin/ventas/{id}/estado

Authentication: Required — admin JWT Updates the status of a specific order. Status changes take effect immediately and are visible to the buyer in GET /mis-compras. The admin panel triggers a client-side stats refresh after a successful update, without a full page reload.

Path Parameter

ParameterTypeDescription
idintegerOrder ID

Request Body

estado
string
required
The new status to assign. Must be one of: pendiente, pagada, enviada, entregada, cancelada.

cURL Example

curl -X PUT https://api-tienda-vinilos.onrender.com/admin/ventas/42/estado \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <admin_token>' \
  -d '{"estado": "enviada"}'

Success Response (200)

{ "message": "Estado actualizado" }

Order Status Lifecycle

StatusDescription
pendienteOrder placed, awaiting processing
pagadaPayment confirmed
enviadaOrder shipped
entregadaOrder delivered to customer
canceladaOrder cancelled
The admin panel frontend renders a colored badge for each status value in the sales table. After calling this endpoint successfully, the panel updates the stats cards (including the pending-orders count) in real time without a full page reload.

Build docs developers (and LLMs) love