Skip to main content

Documentation Index

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

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

Every list endpoint in Gestor Deportivo follows the same pagination pattern: page number and page size are embedded directly in the URL path, and every response includes a pagination object so clients always know the total number of pages without a separate count request.

How it works

Paginated routes expose two optional URL path segments — :pag (page number) and :perpage (results per page) — appended after the base path:
POST /api/<resource>/to-list/:pag?/:perpage?
Both parameters are optional. When omitted, the Paginate middleware defaults to page 1 with 10 results per page. The middleware translates these path parameters into skippag (the number of documents to skip in MongoDB) and limit (the maximum documents to return), then passes them to the controller via req.body.

Example URL

POST /api/team/to-list/1/10
This requests page 1 with 10 teams per page.

Response structure

Every paginated endpoint wraps its results in a consistent envelope:
{
  "msj": "Cargando...",
  "status": true,
  "data": [
    { "_id": "64a1f...", "nameTeam": "FC Example", "description": "..." },
    { "_id": "64a1e...", "nameTeam": "Atletico Demo", "description": "..." }
  ],
  "pagination": {
    "pag": 1,
    "perpage": 10,
    "pags": 5
  }
}
data
array
The array of resource objects for the current page.
pagination.pag
number
The current page number as supplied in the URL.
pagination.perpage
number
The number of results returned on this page.
pagination.pags
number
Total number of pages available, calculated as Math.ceil(totalDocuments / perpage). Use this value to drive client-side pagination UI.

Default behaviour

When :pag and :perpage are omitted, the middleware applies these defaults:
ParameterDefault
pag1 (first page)
perpage10 results
# Omit both parameters to get the first 10 results
curl -X POST https://your-api.com/api/team/to-list \
  -H "access-token: YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json"

Paginated endpoints

Teams

  • POST /api/team/to-list/:pag?/:perpage?
  • POST /api/team/search/-/team/:query/:pag?/:perpage?

Players

  • POST /api/player/to-alls (token required)
  • POST /api/player/search-player/:query/:pag?/:perpage?
  • POST /api/player/to-list-inactive/:activeParam/:pag?/:perpage?

Events

  • POST /api/event/list/:owner/:pag?/:perpage?
  • POST /api/event/list-public/:pag?/:perpage?

Clubs

  • POST /api/club/list-clubs/:pag?/:perpage?

Games

  • POST /api/game/list/:satdeParams/:pag?/:perpage?

Reserves

  • POST /api/reserve/list/:eventId/reserve-accepts/:pag?/:perpage?
  • POST /api/reserve/list/:typeStatus/reserves/:pag?/:perpage?

Notices

  • POST /api/notice/list-notice/:eventId/:pag?/:perpage?
  • POST /api/notice/list-notice-home/:pag?/:perpage?

Users

  • POST /api/user/list-user/:adminId/:pag?/:perpage?
  • POST /api/user/search/:query/:pag?/:perpage?

Full example — page 2 with 20 results

curl -X POST https://your-api.com/api/team/to-list/2/20 \
  -H "access-token: YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json"
Response:
{
  "msj": "Cargando...",
  "status": true,
  "data": [
    { "_id": "64b2a...", "nameTeam": "Deportivo Norte", "description": "..." }
  ],
  "pagination": {
    "pag": "2",
    "perpage": 20,
    "pags": 4
  }
}
Use the pags field (total pages) returned in every response to power your client-side pagination UI or implement a “load more” button. When pag >= pags there are no further pages to fetch.

Build docs developers (and LLMs) love