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 all reservations that have been reviewed and accepted by a lawyer — that is, every document in the database where reservation_accepted is true. Results are sorted by _id in descending order so the most recently created reservations appear first. Pagination is handled automatically by the Paginate middleware using URL path parameters.

Endpoint

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

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-true \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Response

200 — Success

msj
string
A human-readable status message. Value: "Cargando reservas aceptadas".
status
boolean
true when the request was handled successfully.
data
array
Array of FormReserve documents with reservation_accepted: true, sorted newest first.
pagination
object
Pagination metadata for the current response.
{
  "msj": "Cargando reservas aceptadas",
  "status": true,
  "data": [
    {
      "_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": 3
  }
}

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.

Build docs developers (and LLMs) love