Skip to main content

Documentation Index

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

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

This endpoint returns every reservation stored in the database — both accepted and pending — sorted by _id in descending order so the most recently created records appear first. It is the broadest of the three list endpoints and is useful when you need a complete picture of all incoming and confirmed appointments without filtering by reservation_accepted status. Pagination is handled automatically by the Paginate middleware.

Endpoint

POST /api/form/reserve/list/reservation-all

Authentication

Required. Include a valid JWT in the Authorization header as a Bearer token.
Authorization: Bearer <token>

Pagination

Pagination is controlled by two optional URL path parameters passed to the Paginate middleware before the main handler runs:
ParameterLocationDefaultDescription
perpagereq.params.perpage10Number of records to return per page.
pagreq.params.pag0Current page number. Pages greater than 1 are offset by pag - 1 (e.g., page 2 skips the first perpage records). Page 1 or any value ≤ 1 starts from the beginning (skip 0).
The middleware writes the computed values into req.body.skippag (how many records to skip) and req.body.limit (how many to return). These are used directly in the Mongoose query.

Request Body

No request body fields are required. Pagination is derived from URL path parameters as described above.

Example Request

curl -X POST https://your-api-domain.com/api/form/reserve/list/reservation-all \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Response

200 — Success

msj
string
A human-readable status message. Value: "Cargando todas las reservas".
status
boolean
true when the request was handled successfully.
data
array
Array of all FormReserve documents regardless of reservation_accepted value, sorted newest first.
pagination
object
Pagination metadata for the current response.
{
  "msj": "Cargando todas las reservas",
  "status": true,
  "data": [
    {
      "_id": "64f3c7d4e8a11b002a4e9f33",
      "full_name": "Carlos Mendoza Reyes",
      "email": "carlos.mendoza@example.com",
      "phone": 5598765432,
      "required_service": "Derecho penal",
      "preferred_date": "2025-08-22",
      "preferred_hour": "09:00",
      "additional_message": "",
      "reservation_accepted": false,
      "createdAt": "2025-07-31T09:11:47.000Z",
      "updatedAt": "2025-07-31T09:11:47.000Z",
      "__v": 0
    },
    {
      "_id": "64f3a2b1c9e77b001f3d8a12",
      "full_name": "María García López",
      "email": "maria.garcia@example.com",
      "phone": 5512345678,
      "required_service": "Derecho familiar",
      "preferred_date": "2025-08-20",
      "preferred_hour": "11:00",
      "additional_message": "Necesito asesoría sobre un proceso de divorcio.",
      "reservation_accepted": true,
      "createdAt": "2025-07-30T14:22:10.000Z",
      "updatedAt": "2025-07-30T16:05:33.000Z",
      "__v": 0
    }
  ],
  "pagination": {
    "pag": 0,
    "perpage": 10,
    "pags": 5
  }
}

401 — Missing Token

{
  "msj": "Sin autorizacion",
  "status": false
}

403 — Expired Token

{
  "msj": "Sesion finalizada",
  "status": false
}

403 — Invalid Token

Returned when the token fails signature verification or is otherwise malformed.
{
  "msj": "<err.message>. Rechazo en la conexion",
  "status": false
}

404 — Lawyer User Not Found

Returned by the Token middleware when the token is valid but the associated lawyer user no longer exists in the database.
{
  "msj": "Usuario no encontrado",
  "status": false
}

500 — Server Error

Returned when an unexpected error occurs on the server. The response body is the raw error object thrown by the server.
This endpoint is ideal for powering a dashboard overview or administrative reporting screen where staff need to see the full intake volume at a glance. To drill into specific subsets, use List Accepted to view confirmed appointments only, or List Pending to surface reservations that still need a lawyer’s review.

Build docs developers (and LLMs) love