Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Hansel-Pan/sistema-de-informacion-web-para-un-gimnasio/llms.txt

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

The /api/pagos resource records membership fee payments made by gym clients. When a payment is created, the backend calculates the total charge based on the number of days contracted. All historical payment records are preserved and can be listed at any time.

GET /api/pagos

Returns an array of all payment records, ordered by most recent first.

Response fields

id
number
Unique identifier for the payment record.
nombres
string
Full name of the client who made the payment.
identificacion
string
National ID or document number of the client.
fecha_pago
string
Date the payment was recorded, in ISO 8601 format (e.g. 2024-03-10).
dias_contratados
number
Number of membership days purchased in this payment.
total
string | number
Total amount charged for this payment in Colombian pesos (COP). The frontend reads this field as Number(p.total), so the value may be returned as a string by the API.

Example request

curl http://localhost:3001/api/pagos

Example response

[
  {
    "id": 12,
    "nombres": "Juan Pérez",
    "identificacion": "1234567890",
    "fecha_pago": "2024-03-10",
    "dias_contratados": 30,
    "total": 90000
  }
]

POST /api/pagos

Creates a new payment record for a client.
The frontend re-fetches the full client list immediately after a successful payment, and clients display an updated dias_restantes value — suggesting the backend increments the client’s day balance when a payment is created. Confirm this side effect in your backend implementation.

Request body

cliente_id
number
required
The unique ID of the client making the payment. Must correspond to an existing client.
fecha_pago
string
required
The date of the payment in ISO 8601 format (YYYY-MM-DD).
dias_contratados
number
required
Number of membership days being purchased. Accepted range: 1365.

Pricing logic

The total stored in the payment record is computed server-side using the following pricing tiers, which mirror the calcularTotal() function in Pagos.jsx:
Days contractedPrice (COP)
365$1,000,000
30$90,000
15$50,000
1 – 14days × $8,000
For any day count between 1 and 14 inclusive, the charge is calculated as dias_contratados × $8,000. Any value outside the tiers above (i.e. not 1–14, 15, 30, or 365) returns a total of 0 — as reflected by the else → 0 branch in calcularTotal() in Pagos.jsx.

Response fields

id
number
Unique identifier for the newly created payment record.
nombres
string
Full name of the client associated with this payment.
identificacion
string
National ID or document number of the client.
fecha_pago
string
Date of the payment in ISO 8601 format.
dias_contratados
number
Number of days purchased.
total
string | number
Computed total amount charged (COP). The frontend reads this as Number(p.total), so the API may return this value as a string.

Example request

curl -X POST http://localhost:3001/api/pagos \
  -H 'Content-Type: application/json' \
  -d '{
    "cliente_id": 1,
    "fecha_pago": "2024-03-10",
    "dias_contratados": 30
  }'

Example response

{
  "id": 12,
  "nombres": "Juan Pérez",
  "identificacion": "1234567890",
  "fecha_pago": "2024-03-10",
  "dias_contratados": 30,
  "total": 90000
}

Build docs developers (and LLMs) love