Skip to main content

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.

The Config API manages the single GymConfig record that drives your gym’s identity across the application — the name shown in the header, the contact information on receipts, and the logo displayed in the navigation bar. There is always exactly one configuration row; if it has not been seeded, the server auto-creates it with sensible defaults on first read. Logo uploads go through a dedicated multipart endpoint that stores the file in Cloudinary, returning a CDN URL you then persist via PUT /api/config/gym. All endpoints on this page require an admin Bearer token.

GymConfig Object

id
integer
required
Auto-incremented primary key. Always 1 in a freshly seeded database.
name
string
required
Display name of the gym. Default: "SPARTAN'S GYM".
email
string
required
Contact email address. Default: "contacto@spartansgym.com".
phone
string
required
Contact phone number. Default: "+52 55 1234 5678".
address
string
required
Physical address. Default: "Avenida de los Deportes 123, Ciudad de México".
Cloudinary CDN URL of the gym’s logo image, or null if no logo has been uploaded.
createdAt
ISO 8601 datetime
required
UTC timestamp of record creation.
updatedAt
ISO 8601 datetime
required
UTC timestamp of the most recent update.

GET /api/config/gym

Retrieve the current gym configuration. If no record exists yet (first boot), the server creates one with the default values listed above before responding. Auth: Authorization: Bearer <token>admin only

Success Response — 200

{
  "success": true,
  "data": {
    "id": 1,
    "name": "SPARTAN'S GYM",
    "email": "contacto@spartansgym.com",
    "phone": "+52 55 1234 5678",
    "address": "Avenida de los Deportes 123, Ciudad de México",
    "logo": null,
    "createdAt": "2024-01-01T00:00:00.000Z",
    "updatedAt": "2024-01-01T00:00:00.000Z"
  }
}

Error Responses

StatusMeaning
401Missing or invalid Bearer token
403Authenticated user is not an admin
500Internal server error

PUT /api/config/gym

Update one or more fields of the gym configuration. Only the fields you include are changed — all others retain their current values. You may also pass logo directly with a URL string if you already have one; the typical flow is to upload via POST /api/upload/logo first to obtain a Cloudinary URL, then pass it here. Auth: Authorization: Bearer <token>admin only

Request Body

All fields are optional. Send only the fields you want to change.
name
string
Updated gym display name.
email
string
Updated contact email.
phone
string
Updated contact phone number.
address
string
Updated physical address.
logo
string
Cloudinary CDN URL to store as the gym’s logo. Obtain this value from the POST /api/upload/logo response before calling this endpoint.

Success Response — 200

{
  "success": true,
  "data": {
    "id": 1,
    "name": "Spartans Elite Gym",
    "email": "hola@spartanselite.com",
    "phone": "+52 55 9876 5432",
    "address": "Calle Fuerza 77, Colonia Deportiva, CDMX",
    "logo": "https://res.cloudinary.com/spartans/image/upload/v1/gym-logos/logo_abc123.webp",
    "createdAt": "2024-01-01T00:00:00.000Z",
    "updatedAt": "2024-06-15T19:00:00.000Z"
  }
}

Error Responses

StatusMeaning
401Missing or invalid Bearer token
403Authenticated user is not an admin
500Internal server error

Example

curl -X PUT https://api.spartansgym.com/api/config/gym \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Spartans Elite Gym",
    "email": "hola@spartanselite.com",
    "phone": "+52 55 9876 5432",
    "address": "Calle Fuerza 77, Colonia Deportiva, CDMX"
  }'

Upload a gym logo image to Cloudinary. The file is delivered as multipart/form-data with the field name logo. Cloudinary resizes the image to a maximum of 200 × 200 px, applies automatic quality and format optimisation, and returns a permanent CDN URL. Auth: Authorization: Bearer <token>admin only

Request

  • Content-Type: multipart/form-data
  • Form field: logo — the image file (accepted MIME types: image/*)
The uploaded image is stored in the gym-logos Cloudinary folder and transformed automatically:
  • Crop mode: limit (shrinks to fit 200 × 200, never upscales)
  • Quality: auto
  • Format: auto (serves WebP/AVIF where supported)

Success Response — 200

{
  "success": true,
  "data": {
    "url": "https://res.cloudinary.com/spartans/image/upload/v1/gym-logos/logo_abc123.webp",
    "publicId": "gym-logos/logo_abc123"
  }
}
url
string
required
The secure_url from Cloudinary — an HTTPS CDN link ready to be stored in GymConfig.logo.
publicId
string
required
Cloudinary asset identifier (e.g. "gym-logos/logo_abc123"). Retain this if you need to delete or transform the asset via the Cloudinary API later.

Error Responses

StatusBody errorMeaning
400"No se proporcionó ninguna imagen"No file was attached to the logo field
401Missing or invalid Bearer token
403Authenticated user is not an admin
500"Error al subir el logo"Cloudinary upload failure

Example

curl -X POST https://api.spartansgym.com/api/upload/logo \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -F "logo=@/path/to/logo.png"

Logo Update Flow

The full two-step process for replacing the gym logo:
1. POST /api/upload/logo        → multipart upload to Cloudinary
                                   response: { data: { url, publicId } }
2. PUT  /api/config/gym         → persist url in GymConfig.logo
                                   body: { logo: "<url from step 1>" }
The Spartans Gym frontend performs both steps automatically when a user selects a new logo file, so no manual coordination is needed from an admin using the web app. Use the two-step flow only when integrating via the API directly.
There is no server-side file size limit enforced by multer beyond what Cloudinary accepts. The frontend enforces a 5 MB soft cap before uploading. If you call this endpoint directly, keep files under 5 MB to stay consistent with the expected behaviour.

Build docs developers (and LLMs) love