The Transactions API records every financial event that occurs at the gym — membership payments and point-of-sale product sales alike. All three endpoints require a valid Bearer token; no admin privilege is needed, allowing reception staff to create and query records during their shift. Date-range filters are applied against theDocumentation 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.
createdAt UTC timestamp adjusted to the America/Mexico_City (UTC−6) timezone so that a filter for 2024-06-15 captures the full local business day, not a UTC-offset slice.
Transaction Object
Every endpoint that returns transaction data uses this shape.Auto-incremented primary key.
Display date stored as a formatted string, e.g.
"15/jun/2024". Set automatically at creation time in the Mexico City timezone. Not an ISO timestamp.Display time stored as a formatted 12-hour string, e.g.
"03:45 PM". Set automatically at creation time in the Mexico City timezone.First name of the payer. For membership transactions this is pulled from the linked client record. For product sales it defaults to
"Venta".Last name of the payer. Defaults to
"Mostrador" for walk-in product sales.UUID of the linked
Client record. Present for membership transactions; null for product sales.Human-readable description. For product sales this is auto-built from product names, e.g.
"Proteína Whey (x2), Agua 500ml".Transaction amount in MXN, returned as a JavaScript number (the underlying
Decimal is coerced).Payment method used.
Transaction category.
Actual UTC timestamp written by the database. This is the field used for all date-range filtering.
Present only on
GET /api/transactions (not /history). Contains the staff account that created the record.fecha and hora are stored as pre-formatted display strings, not ISO timestamps. Use createdAt for any programmatic date arithmetic or filtering.GET /api/transactions
Retrieve all transactions with optional filters. Results are ordered bycreatedAt descending and include the user relation.
Auth: Authorization: Bearer <token> — any authenticated role
Query Parameters
Filter by transaction category.
Filter by payment method.
Start of the date range (inclusive). Interpreted as midnight Mexico City time (
UTC−6), so 2024-06-15 maps to 2024-06-15T06:00:00Z through 2024-06-16T05:59:59.999Z.End of the date range (inclusive). Adjusts the upper bound of
createdAt to end-of-day Mexico City time for the given date. Ignored if equal to fechaInicio.Success Response — 200
Error Responses
| Status | Meaning |
|---|---|
401 | Missing or invalid Bearer token |
500 | Internal server error |
Example — filtered request
GET /api/transactions/history
Returns the last 100 transactions ordered bycreatedAt descending. No query parameters are accepted. The user relation is not included in this response — use GET /api/transactions when you need staff attribution.
Auth: Authorization: Bearer <token> — any authenticated role
Success Response — 200
Error Responses
| Status | Meaning |
|---|---|
401 | Missing or invalid Bearer token |
500 | Internal server error |
POST /api/transactions
Create a new transaction. Thefecha and hora fields are set automatically using the current Mexico City time — do not pass them in the request body.
Auth: Authorization: Bearer <token> — any authenticated role
Request Body
Determines the transaction category and influences how
nombre, apellidos, and concepto are resolved.Payment method used.
Total transaction amount in MXN.
Required for
tipo: "MEMBRESIA". The client’s id is used to look up their nombre and apellidos for storage on the transaction.Optional free-text description. For
tipo: "PRODUCTO" this field is overwritten by the auto-generated product name list derived from the productos array.Required for
tipo: "PRODUCTO". Each item describes a product being sold.Server-side behaviour by type
PRODUCTO — iteratesproductos, fetches each product by id, appends its name (with quantity suffix) to build concepto, and decrements stock via Product.update. nombre defaults to "Venta", apellidos to "Mostrador".
MEMBRESIA — fetches the Client by clienteId and copies nombre / apellidos from the client record. concepto is taken from the request body as-is.
Success Response — 201
Error Responses
| Status | Meaning |
|---|---|
401 | Missing or invalid Bearer token |
500 | Internal server error or stock update failure |