Every person who walks through the gym door is represented as a Client record. The client model captures identity, contact, membership plan, payment, and attendance data in a single entity. This page covers the full lifecycle of a client record — from creation at the front desk to eventual expiry and deletion.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/azahel79/Spartans-gym/llms.txt
Use this file to discover all available pages before exploring further.
Email addresses were intentionally removed from the client model. Phone number (
telefono) is the unique identifier used for member lookup and search. This decision simplifies the enrollment flow and removes a field that gym staff rarely need.Client Data Model
The table below lists every field stored in theclients database table, its type, and whether it is required at creation time.
| Field | Type | Required | Notes |
|---|---|---|---|
id | String (UUID) | Auto | Generated by the database on creation. |
nombre | String | ✅ | First name(s). |
apellidos | String | ✅ | Last name(s). |
genero | Genero enum | ✅ | Masculino | Femenino | Otro |
telefono | String | ✅ | Used as the primary search identifier. |
plan | String | ✅ | Must match the name of an active Plan record. |
monto | Decimal (MXN) | ✅ | Amount charged at enrollment or last renewal. |
metodoPago | PaymentMethod enum | ✅ | Efectivo | Tarjeta | Transferencia |
status | ClientStatus enum | Auto | Defaults to ACTIVO on creation. |
ultimaVisita | String (HH:MM) | Auto | Last check-in time. Defaults to "--:--". |
vencimiento | DateTime | Auto | Calculated from the plan period at creation. |
fotoUrl | String? | ❌ | Cloudinary URL. Null if no photo uploaded. |
attendanceDate | DateTime? | Auto | Full timestamp of the most recent check-in. |
createdAt | DateTime | Auto | Set by the database on insert. |
updatedAt | DateTime | Auto | Updated automatically on every change. |
Creating a Client
New clients are created viaPOST /api/clients. The request body must include all required fields. fotoUrl is the only optional field.
- Validates that all required fields are present.
- Validates that
generois one ofMasculino,Femenino, orOtro. - Looks up the plan by
nameand confirms it is active (isActive = true). - Calculates the expiry date by adding the plan’s period (in months) to the current date.
- Creates the record with
status = ACTIVOandultimaVisita = "--:--".
HTTP 201 with the full client object.
Photo Upload
Profile photos are hosted on Cloudinary. Upload the image to Cloudinary first (via the/upload endpoint exposed by the frontend or a direct Cloudinary API call), then pass the returned URL as fotoUrl in the client creation payload. The field is entirely optional — the reception UI falls back to a placeholder image when fotoUrl is null.
Expiry Date Calculation
The expiry date is computed at the moment of enrollment based on the selected plan’speriod field. The mapping is:
| Period value | Months added |
|---|---|
"Mes" | 1 |
"3 Meses" / "trimestral" | 3 |
"6 Meses" / "semestral" | 6 |
"Año" / "anual" | 12 |
Searching Clients
GET /api/clients accepts the following optional query parameters to filter results:
| Parameter | Type | Behaviour |
|---|---|---|
search | String | Case-insensitive partial match on nombre, apellidos, or telefono. |
status | String | Exact match. Accepts ACTIVO, VENCIDO, or PENDIENTE. |
plan | String | Exact match on the plan name string. |
createdAt descending (newest first).
Editing a Client
PUT /api/clients/:id updates an existing client record. This endpoint is admin-only.
Any subset of the following fields can be included in the request body:
status, vencimiento, ultimaVisita, and attendanceDate fields cannot be changed through this endpoint — they are managed by dedicated attendance and renewal endpoints.
Deleting a Client
DELETE /api/clients/:id permanently removes the client record and all associated attendance rows (cascade delete). This endpoint is admin-only.
Status Lifecycle
Every client record carries astatus field that reflects the current state of their membership.
ACTIVO
ACTIVO
The default status set at creation and restored after every successful renewal. The client can check in and use the gym’s services. The attendance button in Reception is enabled.
VENCIDO
VENCIDO
Applied automatically when the current date passes the
vencimiento date. The attendance button in Reception is disabled with the label MEMBRESÍA VENCIDA. The client record is retained in full; the member cannot check in until the membership is renewed.PENDIENTE
PENDIENTE
A manual status flag that staff can set on a client to mark them for follow-up (e.g., awaiting payment confirmation, incomplete enrollment). While
PENDIENTE, check-in is also blocked. The transition from VENCIDO to PENDIENTE is intentional — PENDIENTE does not auto-expire back to VENCIDO.