2486 lines
95 KiB
TypeScript
2486 lines
95 KiB
TypeScript
export const openapi: Record<string, unknown> = {
|
||
openapi: '3.0.0',
|
||
info: {
|
||
title: 'FitOS API',
|
||
version: '1.0.0',
|
||
description:
|
||
'FitOS — silnik planów treningowych. Autoryzacja: Bearer access token (15 min) + refresh token (httpOnly cookie).',
|
||
},
|
||
servers: [{ url: '/api/v1' }],
|
||
components: {
|
||
securitySchemes: {
|
||
bearerAuth: { type: 'http', scheme: 'bearer', bearerFormat: 'JWT' },
|
||
},
|
||
schemas: {
|
||
ExerciseReportSet: {
|
||
type: 'object',
|
||
description:
|
||
'Pojedyncza seria w raporcie per ćwiczenie: plan vs. wykonane (numeracja ciągła po sesjach)',
|
||
properties: {
|
||
index: { type: 'integer' },
|
||
planned: {
|
||
type: 'object',
|
||
nullable: true,
|
||
description: 'Seria planowa (null dla serii dodanych ponad plan)',
|
||
properties: {
|
||
reps: { type: 'integer', nullable: true },
|
||
loadKg: { type: 'number', nullable: true },
|
||
restSec: { type: 'integer', nullable: true },
|
||
rir: { type: 'integer', nullable: true },
|
||
},
|
||
},
|
||
actual: {
|
||
type: 'object',
|
||
nullable: true,
|
||
description: 'Wyniki zapisane podczas sesji (null = seria planowa niewykonana)',
|
||
properties: {
|
||
reps: { type: 'integer', nullable: true },
|
||
rir: { type: 'integer', nullable: true },
|
||
difficulty: { type: 'integer', nullable: true, minimum: 1, maximum: 5 },
|
||
},
|
||
},
|
||
note: { type: 'string', nullable: true, description: 'Komentarz trenującego przy serii' },
|
||
},
|
||
},
|
||
ExerciseReport: {
|
||
type: 'object',
|
||
description: 'Ćwiczenie zagregowane po zakończonych sesjach aktywnego planu',
|
||
properties: {
|
||
id: { type: 'string', description: 'Id ćwiczenia z katalogu (klucz agregacji)' },
|
||
name: { type: 'string' },
|
||
nameEn: { type: 'string', nullable: true },
|
||
muscle: { type: 'string' },
|
||
isExtra: { type: 'boolean', description: 'true = wyłącznie ponad plan' },
|
||
sets: { type: 'array', items: { $ref: '#/components/schemas/ExerciseReportSet' } },
|
||
},
|
||
},
|
||
TraineeReport: {
|
||
type: 'object',
|
||
description: 'Raport podopiecznego: partie, dni planu i szczegóły per ćwiczenie',
|
||
properties: {
|
||
plan: {
|
||
type: 'object',
|
||
nullable: true,
|
||
properties: {
|
||
id: { type: 'string' },
|
||
title: { type: 'string' },
|
||
startDate: { type: 'string', format: 'date-time', nullable: true },
|
||
},
|
||
},
|
||
muscles: {
|
||
type: 'array',
|
||
description: 'Plan vs. wykonane per partia + zalecany zakres (scaled to plan weeks)',
|
||
items: {
|
||
type: 'object',
|
||
properties: {
|
||
muscle: { type: 'string' },
|
||
planned: {
|
||
type: 'object',
|
||
properties: { sets: { type: 'integer' }, reps: { type: 'integer' } },
|
||
},
|
||
actual: {
|
||
type: 'object',
|
||
properties: { sets: { type: 'integer' }, reps: { type: 'integer' } },
|
||
},
|
||
extra: { type: 'object', properties: { sets: { type: 'integer' } } },
|
||
missing: { type: 'object', properties: { sets: { type: 'integer' } } },
|
||
completionPct: { type: 'integer' },
|
||
recommendedRange: {
|
||
type: 'object',
|
||
nullable: true,
|
||
properties: { setsMin: { type: 'integer' }, setsMax: { type: 'integer' } },
|
||
},
|
||
outOfRange: { type: 'boolean' },
|
||
},
|
||
},
|
||
},
|
||
days: {
|
||
type: 'array',
|
||
description: 'Dni planu dla heatmapy dyscypliny',
|
||
items: {
|
||
type: 'object',
|
||
properties: {
|
||
date: { type: 'string', format: 'date-time' },
|
||
status: { type: 'string', enum: ['PLANNED', 'COMPLETED', 'SKIPPED'] },
|
||
moved: { type: 'boolean' },
|
||
},
|
||
},
|
||
},
|
||
exercises: {
|
||
type: 'array',
|
||
description:
|
||
'Szczegóły per ćwiczenie (opcjonalne — starsi klienci fallbackują do muscles)',
|
||
items: { $ref: '#/components/schemas/ExerciseReport' },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
paths: {
|
||
'/auth/register': {
|
||
post: {
|
||
tags: ['Auth'],
|
||
summary: 'Self-registration (default role: member)',
|
||
requestBody: {
|
||
required: true,
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
required: ['email', 'password'],
|
||
properties: {
|
||
email: { type: 'string' },
|
||
password: { type: 'string', minLength: 8 },
|
||
firstName: { type: 'string' },
|
||
lastName: { type: 'string' },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
responses: {
|
||
201: { description: 'Created (user + accessToken)' },
|
||
409: { description: 'Email already registered' },
|
||
},
|
||
},
|
||
},
|
||
'/auth/login': {
|
||
post: {
|
||
tags: ['Auth'],
|
||
summary: 'Login',
|
||
description:
|
||
'Writes an ActivityLog entry: user.logged_in (details: client = app|admin, ip = request address). Updates user.lastLoginAt.',
|
||
requestBody: {
|
||
required: true,
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
required: ['email', 'password'],
|
||
properties: {
|
||
email: { type: 'string' },
|
||
password: { type: 'string' },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
responses: {
|
||
200: { description: 'OK (user + accessToken)' },
|
||
401: { description: 'Invalid credentials' },
|
||
403: {
|
||
description:
|
||
'ACCOUNT_SUSPENDED (details: until, reason) or ACCOUNT_BANNED (details: reason)',
|
||
},
|
||
},
|
||
},
|
||
},
|
||
'/auth/refresh': {
|
||
post: {
|
||
tags: ['Auth'],
|
||
summary: 'Refresh access token (refresh cookie)',
|
||
responses: {
|
||
200: { description: 'OK (accessToken)' },
|
||
401: { description: 'Invalid/revoked refresh token' },
|
||
403: {
|
||
description:
|
||
'ACCOUNT_SUSPENDED (details: until, reason) or ACCOUNT_BANNED (details: reason)',
|
||
},
|
||
},
|
||
},
|
||
},
|
||
'/auth/logout': {
|
||
post: {
|
||
tags: ['Auth'],
|
||
summary: 'Logout (clears refresh cookie)',
|
||
description:
|
||
'Writes an ActivityLog entry: user.logged_out (only when a refresh token is present; details: client, ip).',
|
||
},
|
||
},
|
||
'/me': {
|
||
get: {
|
||
tags: ['Profile'],
|
||
summary: 'Current user profile + gym memberships',
|
||
security: [{ bearerAuth: [] }],
|
||
},
|
||
patch: {
|
||
tags: ['Profile'],
|
||
summary: 'Update profile (personal data, priorities, exclusions, available time)',
|
||
security: [{ bearerAuth: [] }],
|
||
requestBody: {
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
properties: {
|
||
firstName: { type: 'string' },
|
||
lastName: { type: 'string' },
|
||
birthDate: { type: 'string', format: 'date', nullable: true },
|
||
heightCm: { type: 'number' },
|
||
availability: {
|
||
type: 'array',
|
||
description: '7 dni (Pon-Niedz), każdy null lub { start, end }',
|
||
items: {
|
||
type: 'object',
|
||
nullable: true,
|
||
properties: { start: { type: 'string' }, end: { type: 'string' } },
|
||
},
|
||
},
|
||
priorities: { type: 'string' },
|
||
exclusions: { type: 'string' },
|
||
developMuscles: { type: 'array', items: { type: 'string' } },
|
||
canDoMuscles: { type: 'array', items: { type: 'string' } },
|
||
difficultMuscles: { type: 'array', items: { type: 'string' } },
|
||
avoidMuscles: { type: 'array', items: { type: 'string' } },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
'/me/password': {
|
||
post: {
|
||
tags: ['Profile'],
|
||
summary: 'Change own password (requires the current one)',
|
||
description:
|
||
'Writes an ActivityLog entry: user.password.changed (details: source — never the passwords). ' +
|
||
'Wrong current password -> 403 INVALID_CREDENTIALS (not 401, so clients do not run the refresh flow).',
|
||
security: [{ bearerAuth: [] }],
|
||
requestBody: {
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
required: ['currentPassword', 'newPassword'],
|
||
properties: {
|
||
currentPassword: { type: 'string' },
|
||
newPassword: { type: 'string', minLength: 8 },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
responses: {
|
||
204: { description: 'Changed' },
|
||
400: { description: 'New password too short' },
|
||
403: { description: 'INVALID_CREDENTIALS — current password incorrect' },
|
||
},
|
||
},
|
||
},
|
||
'/me/active-session': {
|
||
get: {
|
||
tags: ['Sessions'],
|
||
summary: 'Active (IN_PROGRESS) training session of the current user, if any',
|
||
security: [{ bearerAuth: [] }],
|
||
},
|
||
},
|
||
'/me/trainers': {
|
||
get: {
|
||
tags: ['Profile'],
|
||
summary: 'My trainers (ACTIVE coaching relations where I am the trainee)',
|
||
security: [{ bearerAuth: [] }],
|
||
},
|
||
},
|
||
'/me/stats': {
|
||
get: {
|
||
tags: ['Profile'],
|
||
summary:
|
||
'Personal training stats: favorite gym (plan.gymId) / equipment / exercise, muscle split, weekday + day×hour heatmap, 12-week tonnage, Epley records, plan counters',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{
|
||
name: 'range',
|
||
in: 'query',
|
||
schema: { type: 'string', enum: ['30', '90', '365', 'all'], default: '90' },
|
||
},
|
||
],
|
||
},
|
||
},
|
||
'/me/body-parameters': {
|
||
get: {
|
||
tags: ['Profile'],
|
||
summary: 'Body parameters over time (weight + circumference series)',
|
||
security: [{ bearerAuth: [] }],
|
||
},
|
||
},
|
||
'/me/body-parameters/weight': {
|
||
post: {
|
||
tags: ['Profile'],
|
||
summary: 'Add weight measurement',
|
||
security: [{ bearerAuth: [] }],
|
||
requestBody: {
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
required: ['value'],
|
||
properties: { value: { type: 'number' }, date: { type: 'string' } },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
'/me/body-parameters/circumference': {
|
||
post: {
|
||
tags: ['Profile'],
|
||
summary: 'Add circumference measurement',
|
||
security: [{ bearerAuth: [] }],
|
||
requestBody: {
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
required: ['typeId', 'value'],
|
||
properties: {
|
||
typeId: {
|
||
type: 'string',
|
||
enum: ['chest', 'waist', 'hips', 'neck', 'biceps', 'forearm', 'thigh', 'calf'],
|
||
},
|
||
side: { type: 'string', enum: ['left', 'right'], nullable: true },
|
||
value: { type: 'number' },
|
||
date: { type: 'string' },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
'/exercises': {
|
||
get: {
|
||
tags: ['Exercises'],
|
||
summary: 'Exercise pool (MVP: full built-in pool)',
|
||
security: [{ bearerAuth: [] }],
|
||
},
|
||
},
|
||
'/exercises/{id}': {
|
||
get: {
|
||
tags: ['Exercises'],
|
||
summary: 'Exercise details',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
},
|
||
},
|
||
'/gyms': {
|
||
get: {
|
||
tags: ['Gyms'],
|
||
summary: "User's gyms (memberships)",
|
||
security: [{ bearerAuth: [] }],
|
||
},
|
||
post: {
|
||
tags: ['Gyms'],
|
||
summary:
|
||
'Create a gym (creator becomes OWNER; admins only for REAL, REAL requires address)',
|
||
security: [{ bearerAuth: [] }],
|
||
requestBody: {
|
||
required: true,
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
required: ['name'],
|
||
properties: {
|
||
name: { type: 'string' },
|
||
kind: { type: 'string', enum: ['VIRTUAL', 'REAL'], default: 'VIRTUAL' },
|
||
isPrivate: { type: 'boolean', description: 'Tylko dla VIRTUAL' },
|
||
location: {
|
||
type: 'string',
|
||
description: 'Swobodna lokalizacja (VIRTUAL); dla REAL derivowana z adresu',
|
||
},
|
||
addressLine1: { type: 'string', description: 'Ulica i numer (REAL)' },
|
||
addressLine2: { type: 'string', nullable: true },
|
||
postalCode: { type: 'string', description: 'Kod pocztowy 00-001 (REAL)' },
|
||
city: { type: 'string', description: 'Miejscowość (REAL)' },
|
||
countryCode: { type: 'string', default: 'PL', description: 'ISO 3166-1 alpha-2' },
|
||
availability: {
|
||
type: 'array',
|
||
description: '7 dni (Pon-Niedz), każdy null lub { start, end }',
|
||
items: {
|
||
type: 'object',
|
||
nullable: true,
|
||
properties: { start: { type: 'string' }, end: { type: 'string' } },
|
||
},
|
||
},
|
||
capacity: { type: 'integer' },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
'/gyms/all': {
|
||
get: {
|
||
tags: ['Gyms'],
|
||
summary: 'All gyms (for selecting an existing gym)',
|
||
security: [{ bearerAuth: [] }],
|
||
},
|
||
},
|
||
'/gyms/{gymId}/join': {
|
||
post: {
|
||
tags: ['Gyms'],
|
||
summary: 'Join an existing gym (MEMBER membership)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'gymId', in: 'path', required: true, schema: { type: 'string' } }],
|
||
},
|
||
},
|
||
'/gyms/{gymId}/equipment': {
|
||
post: {
|
||
tags: ['Gyms'],
|
||
summary:
|
||
'Create an equipment instance in a gym (owner only); repeats of a catalog type create new instances. Optional spec overrides the catalog spec (validated against its kind)',
|
||
description: 'Writes an ActivityLog entry: gym.equipment.added.',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'gymId', in: 'path', required: true, schema: { type: 'string' } }],
|
||
requestBody: {
|
||
required: true,
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
required: ['equipmentId'],
|
||
properties: {
|
||
equipmentId: { type: 'string' },
|
||
quantity: { type: 'integer', minimum: 1, maximum: 10000 },
|
||
spec: {
|
||
type: 'object',
|
||
nullable: true,
|
||
description: 'Override of the catalog spec, e.g. {minKg,maxKg} / {maxLoadKg}',
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
'/gyms/{gymId}/equipment/{id}': {
|
||
patch: {
|
||
tags: ['Gyms'],
|
||
summary:
|
||
'Change quantity and/or spec override of an equipment instance (owner only); spec:null clears the override',
|
||
description: 'Writes an ActivityLog entry: gym.equipment.updated.',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{ name: 'gymId', in: 'path', required: true, schema: { type: 'string' } },
|
||
{ name: 'id', in: 'path', required: true, schema: { type: 'string' } },
|
||
],
|
||
requestBody: {
|
||
required: true,
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
properties: {
|
||
quantity: { type: 'integer', minimum: 1, maximum: 10000 },
|
||
spec: { type: 'object', nullable: true },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
delete: {
|
||
tags: ['Gyms'],
|
||
summary: 'Remove an equipment instance (and its photos) from a gym (owner only)',
|
||
description: 'Writes an ActivityLog entry: gym.equipment.removed.',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{ name: 'gymId', in: 'path', required: true, schema: { type: 'string' } },
|
||
{ name: 'id', in: 'path', required: true, schema: { type: 'string' } },
|
||
],
|
||
},
|
||
},
|
||
'/gyms/{gymId}/equipment/{id}/photos': {
|
||
post: {
|
||
tags: ['Gyms'],
|
||
summary:
|
||
"Add photos to an equipment instance (owner or admin; multipart field 'photos', max 5, 5 MB)",
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{ name: 'gymId', in: 'path', required: true, schema: { type: 'string' } },
|
||
{ name: 'id', in: 'path', required: true, schema: { type: 'string' } },
|
||
],
|
||
requestBody: {
|
||
required: true,
|
||
content: { 'multipart/form-data': { schema: { type: 'object' } } },
|
||
},
|
||
},
|
||
},
|
||
'/gyms/{gymId}/equipment/{id}/photos/{photoId}': {
|
||
get: {
|
||
tags: ['Gyms'],
|
||
summary:
|
||
'Serve an equipment photo (REAL visible to all logged-in users; VIRTUAL to managers)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{ name: 'gymId', in: 'path', required: true, schema: { type: 'string' } },
|
||
{ name: 'id', in: 'path', required: true, schema: { type: 'string' } },
|
||
{ name: 'photoId', in: 'path', required: true, schema: { type: 'string' } },
|
||
],
|
||
},
|
||
delete: {
|
||
tags: ['Gyms'],
|
||
summary: 'Remove a photo from an equipment instance (owner or admin)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{ name: 'gymId', in: 'path', required: true, schema: { type: 'string' } },
|
||
{ name: 'id', in: 'path', required: true, schema: { type: 'string' } },
|
||
{ name: 'photoId', in: 'path', required: true, schema: { type: 'string' } },
|
||
],
|
||
},
|
||
},
|
||
'/gyms/{gymId}': {
|
||
get: {
|
||
tags: ['Gyms'],
|
||
summary:
|
||
"Public gym detail (REAL and public VIRTUAL visible to all logged-in users; private VIRTUAL to managers). Public VIRTUAL response includes the caller's myVote",
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'gymId', in: 'path', required: true, schema: { type: 'string' } }],
|
||
responses: {
|
||
200: { description: 'OK, returns { gym, roles, isAdmin }' },
|
||
403: { description: 'Private VIRTUAL gym and the caller is not a manager' },
|
||
404: { description: 'Gym not found' },
|
||
},
|
||
},
|
||
patch: {
|
||
tags: ['Gyms'],
|
||
summary: 'Update a gym (owner only)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'gymId', in: 'path', required: true, schema: { type: 'string' } }],
|
||
requestBody: {
|
||
required: false,
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
properties: {
|
||
name: { type: 'string' },
|
||
location: { type: 'string', nullable: true },
|
||
availability: { type: 'array', nullable: true },
|
||
capacity: { type: 'integer', nullable: true },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
delete: {
|
||
tags: ['Gyms'],
|
||
summary: 'Delete a gym (owner only). Memberships are removed; user plans are kept.',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'gymId', in: 'path', required: true, schema: { type: 'string' } }],
|
||
},
|
||
},
|
||
'/gyms/{gymId}/exceptions': {
|
||
get: {
|
||
tags: ['Gyms'],
|
||
summary: "List a gym's schedule exceptions (owner only)",
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'gymId', in: 'path', required: true, schema: { type: 'string' } }],
|
||
},
|
||
post: {
|
||
tags: ['Gyms'],
|
||
summary: 'Add a one-off schedule exception (owner only)',
|
||
description: 'Writes an ActivityLog entry: gym.exception.added.',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'gymId', in: 'path', required: true, schema: { type: 'string' } }],
|
||
requestBody: {
|
||
required: true,
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
required: ['date'],
|
||
properties: {
|
||
date: { type: 'string', description: 'YYYY-MM-DD' },
|
||
availability: {
|
||
type: 'object',
|
||
nullable: true,
|
||
description: 'null = closed, { start, end } = different hours',
|
||
properties: { start: { type: 'string' }, end: { type: 'string' } },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
'/gyms/{gymId}/exceptions/{exceptionId}': {
|
||
delete: {
|
||
tags: ['Gyms'],
|
||
summary: 'Remove a schedule exception (owner only)',
|
||
description: 'Writes an ActivityLog entry: gym.exception.removed.',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{ name: 'gymId', in: 'path', required: true, schema: { type: 'string' } },
|
||
{ name: 'exceptionId', in: 'path', required: true, schema: { type: 'string' } },
|
||
],
|
||
},
|
||
},
|
||
'/gyms/{gymId}/announcements': {
|
||
get: {
|
||
tags: ['Gyms'],
|
||
summary: "List the gym's announcements (any member; canManage = OWNER)",
|
||
description:
|
||
'Announcements carry author attribution: authorId, authorName, authorRole (ADMIN | OWNER | TRAINER; null for system-generated).',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'gymId', in: 'path', required: true, schema: { type: 'string' } }],
|
||
},
|
||
post: {
|
||
tags: ['Gyms'],
|
||
summary: "Publish an announcement to the gym's members (owner only)",
|
||
description: 'Writes an ActivityLog entry: announcement.published.',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'gymId', in: 'path', required: true, schema: { type: 'string' } }],
|
||
requestBody: {
|
||
required: true,
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
required: ['title', 'body'],
|
||
properties: {
|
||
title: { type: 'string', maxLength: 120 },
|
||
body: { type: 'string', maxLength: 2000 },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
'/gyms/{gymId}/announcements/{announcementId}': {
|
||
patch: {
|
||
tags: ['Gyms'],
|
||
summary: 'Edit a manual announcement (owner only)',
|
||
description: 'Writes an ActivityLog entry: announcement.updated.',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{ name: 'gymId', in: 'path', required: true, schema: { type: 'string' } },
|
||
{ name: 'announcementId', in: 'path', required: true, schema: { type: 'string' } },
|
||
],
|
||
requestBody: {
|
||
required: true,
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
required: ['title', 'body'],
|
||
properties: {
|
||
title: { type: 'string', maxLength: 120 },
|
||
body: { type: 'string', maxLength: 2000 },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
delete: {
|
||
tags: ['Gyms'],
|
||
summary: 'Delete a manual announcement (owner only)',
|
||
description: 'Writes an ActivityLog entry: announcement.deleted.',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{ name: 'gymId', in: 'path', required: true, schema: { type: 'string' } },
|
||
{ name: 'announcementId', in: 'path', required: true, schema: { type: 'string' } },
|
||
],
|
||
},
|
||
},
|
||
'/gyms/{gymId}/check-in': {
|
||
post: {
|
||
tags: ['Gyms'],
|
||
summary:
|
||
'Check in to a real gym (QR deep link source=QR or manual "Idę ćwiczyć"). Idempotent when already checked in to the same gym; closes the previous presence when moving A->B; revives an EXPIRED presence of the same gym via gap-merge (<=15 min since last activity)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'gymId', in: 'path', required: true, schema: { type: 'string' } }],
|
||
requestBody: {
|
||
required: false,
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
properties: {
|
||
source: { type: 'string', enum: ['QR', 'MANUAL'], default: 'MANUAL' },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
responses: {
|
||
200: { description: 'OK, returns { presence }' },
|
||
400: { description: 'VIRTUAL gym rejects check-in' },
|
||
404: { description: 'Gym not found' },
|
||
},
|
||
},
|
||
},
|
||
'/gyms/{gymId}/equipment-usage': {
|
||
get: {
|
||
tags: ['Gyms'],
|
||
summary:
|
||
'Equipment usage heatmap of a gym: rows = equipment, 24 hourly cells aggregated from sessions started within presence windows (default range: last 30 days). REAL visible to all logged-in users; VIRTUAL to managers only (empty — presence is REAL only)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{ name: 'gymId', in: 'path', required: true, schema: { type: 'string' } },
|
||
{ name: 'from', in: 'query', schema: { type: 'string', format: 'date-time' } },
|
||
{ name: 'to', in: 'query', schema: { type: 'string', format: 'date-time' } },
|
||
],
|
||
responses: {
|
||
200: {
|
||
description:
|
||
'OK, returns { equipment: [{ equipmentId, name, nameEn, cells: [{ hour, count }], peak }] } (sorted by total uses desc)',
|
||
},
|
||
403: { description: 'VIRTUAL gym and the caller is not a manager' },
|
||
404: { description: 'Gym not found' },
|
||
},
|
||
},
|
||
},
|
||
'/gyms/{gymId}/presence-stats': {
|
||
get: {
|
||
tags: ['Gyms'],
|
||
summary:
|
||
'Presence telemetry of a gym (general view): day×hour heatmap, avg stay, visits/day, peak, live, top equipment. REAL visible to all logged-in users; VIRTUAL to managers only (empty — presence is REAL only). Default range: last 30 days',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{ name: 'gymId', in: 'path', required: true, schema: { type: 'string' } },
|
||
{ name: 'from', in: 'query', schema: { type: 'string', format: 'date-time' } },
|
||
{ name: 'to', in: 'query', schema: { type: 'string', format: 'date-time' } },
|
||
],
|
||
responses: {
|
||
200: {
|
||
description:
|
||
'OK, returns { gym, stats: { visits, avgStayMinutes, heatmap: [{ day, hour, count }], topGyms, peak, topEquipment, live, visitsPerDay } }',
|
||
},
|
||
403: { description: 'VIRTUAL gym and the caller is not a manager' },
|
||
404: { description: 'Gym not found' },
|
||
},
|
||
},
|
||
},
|
||
'/gyms/{gymId}/stats/overview': {
|
||
get: {
|
||
tags: ['Gyms'],
|
||
summary:
|
||
'Owner stats overview of a real gym: presence telemetry (visits/day, avg stay, peak, live, day×hour heatmap) + members and inflow + training activity from sessions started within presence windows (anonymous). Owner or admin only; default range: last 30 days',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{ name: 'gymId', in: 'path', required: true, schema: { type: 'string' } },
|
||
{ name: 'from', in: 'query', schema: { type: 'string', format: 'date-time' } },
|
||
{ name: 'to', in: 'query', schema: { type: 'string', format: 'date-time' } },
|
||
],
|
||
responses: {
|
||
200: {
|
||
description:
|
||
'OK, returns { gym, presence: { visits, visitsPerDay, avgStayMinutes, peak, live, heatmap }, members: { total, byRole, newInRange }, activity: { sessionsStarted, sessionsCompleted, sessionsAbandoned, uniqueExercisers } }',
|
||
},
|
||
400: { description: 'VIRTUAL gym' },
|
||
403: { description: 'Caller is not the gym owner or an admin' },
|
||
404: { description: 'Gym not found' },
|
||
},
|
||
},
|
||
},
|
||
'/gyms/{gymId}/board': {
|
||
get: {
|
||
tags: ['Gyms'],
|
||
summary:
|
||
'Gym stats board (REAL only): anonymous aggregates over every exerciser of the gym (tonnage, sessions, unique exercisers, muscle split) + top-10 ranking by effective completed sessions and top-5 all-time Epley 1RM records with nickname attribution only for members who opted in (statsOptIn, account ACTIVE). Members (any role) or admin; range 7/30/90 days (default 30) applies to ranking and aggregates; records always all-time',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{ name: 'gymId', in: 'path', required: true, schema: { type: 'string' } },
|
||
{
|
||
name: 'range',
|
||
in: 'query',
|
||
schema: { type: 'string', enum: ['7', '30', '90'], default: '30' },
|
||
},
|
||
],
|
||
responses: {
|
||
200: {
|
||
description:
|
||
'OK, returns { gym: { id, name }, myStatsOptIn: boolean|null (null for admins without membership), rangeDays, ranking: [{ userId, nickname, firstName, lastName, sessions, tonnageKg, days }], aggregate: { tonnageKg, sessions, uniqueExercisers, muscles: [{ muscle, sets, volumeKg }] }, records: [{ exerciseId, name, nameEn, muscle, oneRm, date, author: { nickname, firstName, lastName }|null }] }',
|
||
},
|
||
400: { description: 'VIRTUAL gym' },
|
||
403: { description: 'Caller is not a gym member (and not an admin)' },
|
||
404: { description: 'Gym not found' },
|
||
},
|
||
},
|
||
},
|
||
'/gyms/{gymId}/stats-consent': {
|
||
patch: {
|
||
tags: ['Gyms'],
|
||
summary:
|
||
'Opt in/out of nickname attribution on the gym stats board (per-gym consent on the membership; anonymous aggregates are unaffected). Member only; REAL only',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'gymId', in: 'path', required: true, schema: { type: 'string' } }],
|
||
requestBody: {
|
||
required: true,
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
required: ['enabled'],
|
||
properties: { enabled: { type: 'boolean' } },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
responses: {
|
||
200: { description: 'OK, returns { statsOptIn }' },
|
||
400: { description: 'VIRTUAL gym' },
|
||
403: { description: 'Caller is not a gym member' },
|
||
404: { description: 'Gym not found' },
|
||
},
|
||
},
|
||
},
|
||
'/gyms/{gymId}/contact': {
|
||
get: {
|
||
tags: ['GymContact'],
|
||
summary:
|
||
'Gym contact: member sees own thread (lazily null) with canReply; gym OWNER/admin see the gym thread list (last message + unread)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'gymId', in: 'path', required: true, schema: { type: 'string' } }],
|
||
responses: {
|
||
200: {
|
||
description:
|
||
"OK, returns { role: 'member', conversation|null, messages[], canReply } or { role: 'owner'|'admin', threads[] }",
|
||
},
|
||
403: { description: 'Caller is not a member/owner of the gym' },
|
||
404: { description: 'Gym not found' },
|
||
},
|
||
},
|
||
},
|
||
'/gyms/{gymId}/contact/messages': {
|
||
post: {
|
||
tags: ['GymContact'],
|
||
summary:
|
||
'Member starts or replies in own (gymId,userId) thread — active membership required; thread upserted',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'gymId', in: 'path', required: true, schema: { type: 'string' } }],
|
||
requestBody: {
|
||
required: true,
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
required: ['body'],
|
||
properties: { body: { type: 'string', minLength: 1, maxLength: 1000 } },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
responses: {
|
||
201: { description: 'Created, returns { conversation }' },
|
||
403: { description: 'Not an active member of the gym' },
|
||
404: { description: 'Gym not found' },
|
||
},
|
||
},
|
||
},
|
||
'/gym-contact/conversations': {
|
||
get: {
|
||
tags: ['GymContact'],
|
||
summary:
|
||
"Owner inbox: threads of gyms where caller is OWNER (admin: all threads), last message + caller's unread count",
|
||
security: [{ bearerAuth: [] }],
|
||
responses: {
|
||
200: {
|
||
description:
|
||
'OK, returns { conversations: [{ id, gymId, gymName, userId, counterpartName, lastMessageBody, lastMessageAt, unreadCount }] }',
|
||
},
|
||
},
|
||
},
|
||
},
|
||
'/gym-contact/conversations/{conversationId}': {
|
||
get: {
|
||
tags: ['GymContact'],
|
||
summary: 'Single contact thread (participant only) + read-mark',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{ name: 'conversationId', in: 'path', required: true, schema: { type: 'string' } },
|
||
],
|
||
responses: {
|
||
200: {
|
||
description:
|
||
'OK, returns { role, conversation: { id, gymId, gymName, userId, memberName }, messages[], canReply }',
|
||
},
|
||
403: { description: 'Thread member no longer a gym member' },
|
||
404: { description: 'Not found or not a participant' },
|
||
},
|
||
},
|
||
},
|
||
'/gym-contact/conversations/{conversationId}/messages': {
|
||
post: {
|
||
tags: ['GymContact'],
|
||
summary: 'Reply in a contact thread (OWNER/admin or thread member)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{ name: 'conversationId', in: 'path', required: true, schema: { type: 'string' } },
|
||
],
|
||
requestBody: {
|
||
required: true,
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
required: ['body'],
|
||
properties: { body: { type: 'string', minLength: 1, maxLength: 1000 } },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
responses: {
|
||
201: { description: 'Created, returns { message }' },
|
||
403: { description: 'Thread member no longer a gym member' },
|
||
404: { description: 'Not found or not a participant' },
|
||
},
|
||
},
|
||
},
|
||
'/gym-contact/messages/{messageId}': {
|
||
delete: {
|
||
tags: ['GymContact'],
|
||
summary: 'Delete a contact message (author only)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'messageId', in: 'path', required: true, schema: { type: 'string' } }],
|
||
responses: {
|
||
204: { description: 'Deleted' },
|
||
404: { description: 'Message not found or not the author' },
|
||
},
|
||
},
|
||
},
|
||
'/me/presence': {
|
||
get: {
|
||
tags: ['Presence'],
|
||
summary: 'Active presence of the caller (null when not checked in)',
|
||
security: [{ bearerAuth: [] }],
|
||
responses: { 200: { description: 'OK, returns { presence: object|null }' } },
|
||
},
|
||
},
|
||
'/me/presence/check-out': {
|
||
post: {
|
||
tags: ['Presence'],
|
||
summary: 'Leave the gym ("Wychodzę") — ACTIVE -> CLOSED; no-op without an active presence',
|
||
security: [{ bearerAuth: [] }],
|
||
responses: { 200: { description: 'OK, returns { checkedOut: boolean }' } },
|
||
},
|
||
},
|
||
'/me/presence/heartbeat': {
|
||
post: {
|
||
tags: ['Presence'],
|
||
summary:
|
||
"Refresh the presence slot ('Wciąż tu jestem' / workout-screen heartbeat, client throttles to 60s)",
|
||
security: [{ bearerAuth: [] }],
|
||
responses: { 200: { description: 'OK, returns { touched: boolean }' } },
|
||
},
|
||
},
|
||
'/me/presence/history': {
|
||
get: {
|
||
tags: ['Presence'],
|
||
summary: 'Visit history of the caller',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{ name: 'from', in: 'query', schema: { type: 'string', format: 'date-time' } },
|
||
{ name: 'to', in: 'query', schema: { type: 'string', format: 'date-time' } },
|
||
{ name: 'gymId', in: 'query', schema: { type: 'string' } },
|
||
],
|
||
responses: { 200: { description: 'OK, returns { visits: [...] }' } },
|
||
},
|
||
},
|
||
'/me/presence/stats': {
|
||
get: {
|
||
tags: ['Presence'],
|
||
summary:
|
||
"Visit stats ('Moje wizyty'): top gyms, day×hour heatmap, avg stay, top equipment (derived from sessions started within presence windows)",
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{ name: 'from', in: 'query', schema: { type: 'string', format: 'date-time' } },
|
||
{ name: 'to', in: 'query', schema: { type: 'string', format: 'date-time' } },
|
||
],
|
||
responses: { 200: { description: 'OK, returns { stats }' } },
|
||
},
|
||
},
|
||
'/me/feed': {
|
||
get: {
|
||
tags: ['Feed'],
|
||
summary:
|
||
'Merged feed of personal notifications and gym/global announcements (cursor = createdAt)',
|
||
description:
|
||
'Announcement items carry author attribution: authorId, authorName, authorRole (ADMIN | OWNER | TRAINER; null for system-generated). Notification types: PLAN_READY, PLAN_EDITED (payload: planId, planTitle, note; deeplink /plans/:id), PLAN_SHARED, GYM_DELETED, TRAINER_COMMENT (payload: sessionId, trainerName; deeplink /profile/history).',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{ name: 'limit', in: 'query', schema: { type: 'integer', default: 20 } },
|
||
{
|
||
name: 'cursor',
|
||
in: 'query',
|
||
schema: { type: 'string' },
|
||
description: 'ISO createdAt of the last item on the page',
|
||
},
|
||
],
|
||
},
|
||
},
|
||
'/me/feed/unread-count': {
|
||
get: {
|
||
tags: ['Feed'],
|
||
summary: 'Unread counter (notifications + visible announcements)',
|
||
security: [{ bearerAuth: [] }],
|
||
},
|
||
},
|
||
'/me/feed/read-all': {
|
||
post: {
|
||
tags: ['Feed'],
|
||
summary: 'Mark all feed items as read (both sources)',
|
||
security: [{ bearerAuth: [] }],
|
||
},
|
||
},
|
||
'/me/feed/notifications/{id}/read': {
|
||
post: {
|
||
tags: ['Feed'],
|
||
summary: 'Mark a personal notification as read',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
},
|
||
},
|
||
'/me/feed/announcements/{id}': {
|
||
get: {
|
||
tags: ['Feed'],
|
||
summary:
|
||
'Single announcement with author info (visible to the user only); GET marks it as read',
|
||
description: 'Returns { announcement: {...authorId, authorName, authorRole}, read: true }.',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
},
|
||
},
|
||
'/me/feed/announcements/{id}/read': {
|
||
post: {
|
||
tags: ['Feed'],
|
||
summary: 'Mark an announcement as read (visible to the user only)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
},
|
||
},
|
||
'/admin/equipment': {
|
||
get: {
|
||
tags: ['Equipment'],
|
||
summary: 'List the equipment (machine/device) catalog with usage counts (admin)',
|
||
security: [{ bearerAuth: [] }],
|
||
},
|
||
post: {
|
||
tags: ['Equipment'],
|
||
summary: 'Create an equipment catalog entry (admin)',
|
||
description: 'Writes an ActivityLog entry: equipment.created.',
|
||
security: [{ bearerAuth: [] }],
|
||
requestBody: {
|
||
required: true,
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
required: ['name'],
|
||
properties: {
|
||
name: { type: 'string' },
|
||
nameEn: { type: 'string', nullable: true },
|
||
description: { type: 'string', nullable: true },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
'/admin/equipment/{id}': {
|
||
patch: {
|
||
tags: ['Equipment'],
|
||
summary: 'Update an equipment catalog entry (admin)',
|
||
description: 'Writes an ActivityLog entry: equipment.updated.',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
},
|
||
delete: {
|
||
tags: ['Equipment'],
|
||
summary: 'Delete an equipment catalog entry (admin)',
|
||
description: 'Writes an ActivityLog entry: equipment.deleted.',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
},
|
||
},
|
||
'/admin/exercises': {
|
||
get: {
|
||
tags: ['Exercises'],
|
||
summary: 'List exercise types with linked equipment and plan-usage count (admin)',
|
||
security: [{ bearerAuth: [] }],
|
||
},
|
||
post: {
|
||
tags: ['Exercises'],
|
||
summary:
|
||
'Create an exercise type (admin). Optional has* flags override the default strength combination.',
|
||
description: 'Writes an ActivityLog entry: exercise.created.',
|
||
security: [{ bearerAuth: [] }],
|
||
requestBody: {
|
||
required: true,
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
required: ['name', 'primaryMuscle'],
|
||
properties: {
|
||
name: { type: 'string' },
|
||
nameEn: { type: 'string', nullable: true },
|
||
primaryMuscle: { type: 'string' },
|
||
secondaryMuscles: { type: 'array', items: { type: 'string' } },
|
||
description: { type: 'string', nullable: true },
|
||
howTo: { type: 'string', nullable: true },
|
||
commonMistakes: { type: 'string', nullable: true },
|
||
equipmentIds: { type: 'array', items: { type: 'string' } },
|
||
hasReps: { type: 'boolean' },
|
||
hasLoad: { type: 'boolean' },
|
||
hasRest: { type: 'boolean' },
|
||
hasSets: { type: 'boolean' },
|
||
hasRir: { type: 'boolean' },
|
||
hasDifficulty: { type: 'boolean' },
|
||
hasCardio: { type: 'boolean' },
|
||
hasTime: { type: 'boolean' },
|
||
hasSpeed: { type: 'boolean' },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
'/admin/exercises/{id}': {
|
||
get: {
|
||
tags: ['Exercises'],
|
||
summary: 'Get an exercise type with linked equipment (admin)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
},
|
||
patch: {
|
||
tags: ['Exercises'],
|
||
summary:
|
||
'Update an exercise type (admin). equipmentIds replaces the linked set; has* flags optional.',
|
||
description: 'Writes an ActivityLog entry: exercise.updated.',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
},
|
||
delete: {
|
||
tags: ['Exercises'],
|
||
summary: 'Delete an exercise type (admin). Fails if used in plans.',
|
||
description: 'Writes an ActivityLog entry: exercise.deleted.',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
},
|
||
},
|
||
'/admin/announcements': {
|
||
get: {
|
||
tags: ['Admin'],
|
||
summary: 'List all announcements or those of one gym (?gymId=) (admin)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'gymId', in: 'query', schema: { type: 'string' } }],
|
||
},
|
||
post: {
|
||
tags: ['Admin'],
|
||
summary: 'Create an announcement — global (gymId null) or for a gym (admin)',
|
||
description: 'Writes an ActivityLog entry: announcement.published.',
|
||
security: [{ bearerAuth: [] }],
|
||
requestBody: {
|
||
required: true,
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
required: ['title', 'body'],
|
||
properties: {
|
||
title: { type: 'string', maxLength: 120 },
|
||
body: { type: 'string', maxLength: 2000 },
|
||
gymId: { type: 'string', nullable: true },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
'/admin/announcements/{id}': {
|
||
patch: {
|
||
tags: ['Admin'],
|
||
summary: 'Edit a manual announcement (admin)',
|
||
description: 'Writes an ActivityLog entry: announcement.updated.',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
requestBody: {
|
||
required: true,
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
required: ['title', 'body'],
|
||
properties: {
|
||
title: { type: 'string', maxLength: 120 },
|
||
body: { type: 'string', maxLength: 2000 },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
delete: {
|
||
tags: ['Admin'],
|
||
summary: 'Delete a manual announcement (admin)',
|
||
description: 'Writes an ActivityLog entry: announcement.deleted.',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
},
|
||
},
|
||
'/focus-areas': {
|
||
get: {
|
||
tags: ['FocusAreas'],
|
||
summary: 'Catalog of training focus areas to choose priorities/exclusions from',
|
||
security: [{ bearerAuth: [] }],
|
||
},
|
||
},
|
||
'/admin/focus-areas': {
|
||
get: {
|
||
tags: ['Admin'],
|
||
summary: 'List focus areas with exercise usage counts (admin)',
|
||
security: [{ bearerAuth: [] }],
|
||
},
|
||
post: {
|
||
tags: ['Admin'],
|
||
summary: 'Create a focus area (admin). Requires setsMin <= setsMax when both are set.',
|
||
description: 'Writes an ActivityLog entry: focus_area.created.',
|
||
security: [{ bearerAuth: [] }],
|
||
requestBody: {
|
||
required: true,
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
required: ['name', 'muscle'],
|
||
properties: {
|
||
name: { type: 'string' },
|
||
nameEn: { type: 'string', nullable: true },
|
||
muscle: { type: 'string' },
|
||
description: { type: 'string', nullable: true },
|
||
setsMin: { type: 'integer', nullable: true, minimum: 0, maximum: 100 },
|
||
setsMax: { type: 'integer', nullable: true, minimum: 0, maximum: 100 },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
'/admin/focus-areas/{id}': {
|
||
patch: {
|
||
tags: ['Admin'],
|
||
summary: 'Update a focus area (admin). Sets range validated against the merged values.',
|
||
description: 'Writes an ActivityLog entry: focus_area.updated.',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
},
|
||
delete: {
|
||
tags: ['Admin'],
|
||
summary: 'Delete a focus area (admin)',
|
||
description: 'Writes an ActivityLog entry: focus_area.deleted.',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
},
|
||
},
|
||
'/admin/gyms/{id}/equipment': {
|
||
post: {
|
||
tags: ['Admin'],
|
||
summary:
|
||
'Create an equipment instance in a gym (admin); repeats of a catalog type create new instances. Optional spec overrides the catalog spec (validated against its kind)',
|
||
description: 'Writes an ActivityLog entry: gym.equipment.added.',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
requestBody: {
|
||
required: true,
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
required: ['equipmentId'],
|
||
properties: {
|
||
equipmentId: { type: 'string' },
|
||
quantity: { type: 'integer', minimum: 1, maximum: 10000 },
|
||
spec: { type: 'object', nullable: true },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
'/admin/gyms/{id}/equipment/{instanceId}': {
|
||
patch: {
|
||
tags: ['Admin'],
|
||
summary:
|
||
'Change quantity and/or spec override of an equipment instance (admin); spec:null clears the override',
|
||
description: 'Writes an ActivityLog entry: gym.equipment.updated.',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{ name: 'id', in: 'path', required: true, schema: { type: 'string' } },
|
||
{ name: 'instanceId', in: 'path', required: true, schema: { type: 'string' } },
|
||
],
|
||
requestBody: {
|
||
required: true,
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
properties: {
|
||
quantity: { type: 'integer', minimum: 1, maximum: 10000 },
|
||
spec: { type: 'object', nullable: true },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
delete: {
|
||
tags: ['Admin'],
|
||
summary: 'Remove an equipment instance (and its photos) from a gym (admin)',
|
||
description: 'Writes an ActivityLog entry: gym.equipment.removed.',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{ name: 'id', in: 'path', required: true, schema: { type: 'string' } },
|
||
{ name: 'instanceId', in: 'path', required: true, schema: { type: 'string' } },
|
||
],
|
||
},
|
||
},
|
||
'/plans': {
|
||
get: {
|
||
tags: ['Plans'],
|
||
summary: "User's plans",
|
||
security: [{ bearerAuth: [] }],
|
||
},
|
||
post: {
|
||
tags: ['Plans'],
|
||
summary:
|
||
'Create plan (always a DRAFT): weeks -> days (dayOfWeek) -> exercises (min 1 per day) -> sets. Optional startDate (a Monday of the current or a future week) is stored as the planned start; activation is a separate action (POST /plans/{id}/activate). Days that would fall before today under the marked start are rejected with code PLAN_DAY_IN_PAST. Optional gymId (informational; the plan owner must be a gym member) and per-week customName (alias, max 40)',
|
||
security: [{ bearerAuth: [] }],
|
||
requestBody: {
|
||
required: true,
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
required: ['title', 'weeksCount', 'weeks'],
|
||
properties: {
|
||
title: { type: 'string' },
|
||
weeksCount: { type: 'integer', minimum: 1, maximum: 52 },
|
||
gymId: {
|
||
type: 'string',
|
||
nullable: true,
|
||
description: 'Informational gym; the plan owner must be a member of it',
|
||
},
|
||
startDate: {
|
||
type: 'string',
|
||
description: 'YYYY-MM-DD, must be a Monday of the current or a future week',
|
||
},
|
||
changeNote: {
|
||
type: 'string',
|
||
maxLength: 300,
|
||
description:
|
||
'PATCH only, optional note recorded in the plan edit history for ACTIVE-plan edits (empty/absent = no note)',
|
||
},
|
||
weeks: {
|
||
type: 'array',
|
||
items: {
|
||
type: 'object',
|
||
required: ['index', 'days'],
|
||
properties: {
|
||
index: { type: 'integer', minimum: 0 },
|
||
customName: { type: 'string', nullable: true, maxLength: 40 },
|
||
days: {
|
||
type: 'array',
|
||
items: {
|
||
type: 'object',
|
||
required: ['dayOfWeek', 'exercises'],
|
||
properties: {
|
||
id: {
|
||
type: 'string',
|
||
description:
|
||
'Existing day id — keeps the row (and its history) when editing an ACTIVE plan',
|
||
},
|
||
dayOfWeek: { type: 'integer', minimum: 1, maximum: 7 },
|
||
exercises: {
|
||
type: 'array',
|
||
minItems: 1,
|
||
description: 'A training day without exercises is rejected',
|
||
items: {
|
||
type: 'object',
|
||
required: ['exerciseId', 'order', 'sets'],
|
||
properties: {
|
||
id: {
|
||
type: 'string',
|
||
description: 'Existing plan-exercise id (ACTIVE edit)',
|
||
},
|
||
exerciseId: { type: 'string' },
|
||
order: { type: 'integer', minimum: 0 },
|
||
sets: {
|
||
type: 'array',
|
||
minItems: 1,
|
||
items: {
|
||
type: 'object',
|
||
required: ['index'],
|
||
properties: {
|
||
id: {
|
||
type: 'string',
|
||
description: 'Existing plan-set id (ACTIVE edit)',
|
||
},
|
||
index: { type: 'integer' },
|
||
reps: { type: 'integer', nullable: true },
|
||
loadKg: { type: 'number', nullable: true },
|
||
restSec: { type: 'integer', nullable: true },
|
||
rir: { type: 'integer', nullable: true },
|
||
cardioBpm: { type: 'integer', nullable: true },
|
||
timeSec: { type: 'integer', nullable: true },
|
||
speed: { type: 'number', nullable: true },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
'/plans/shared-with-me': {
|
||
get: {
|
||
tags: ['Plans'],
|
||
summary: 'Plans explicitly shared with the user (read-only)',
|
||
security: [{ bearerAuth: [] }],
|
||
},
|
||
},
|
||
'/plans/{id}': {
|
||
get: {
|
||
tags: ['Plans'],
|
||
summary:
|
||
'Plan details. Access: owner, trainer with an ACTIVE coaching relation, or a share recipient (read-only)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
},
|
||
patch: {
|
||
tags: ['Plans'],
|
||
summary:
|
||
'Update plan structure. DRAFT = full replace (same body as POST /plans; optional startDate (a Monday of the current or a future week) updates the planned start — the plan stays a DRAFT, activation is separate; days falling before today under the marked start are rejected with code PLAN_DAY_IN_PAST). ACTIVE = differential edit: rows matched by the ids sent in the payload are updated in place, new rows are added, the plan start date is immutable, and any real change is recorded in the plan edit history (plan.edits) with an optional changeNote. Removing a day that has training history is rejected with code PLAN_DAY_HAS_HISTORY unless the payload sets forceRemoveDays: true — then the day is soft-removed (removedAt), its row and sessions stay in history while the day disappears from the plan, calendar, stats and killstreak. When an ACTIVE plan actually changes and the editor is not its owner (trainer edit), the owner gets a PLAN_EDITED notification in their feed',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
requestBody: {
|
||
required: true,
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
$ref: '#/paths/~1plans/post/requestBody/content/application~1json/schema',
|
||
},
|
||
},
|
||
},
|
||
},
|
||
responses: {
|
||
200: { description: 'OK' },
|
||
400: {
|
||
description:
|
||
'Not a draft/active plan / start date not a Monday / start week in the past / change note required / PLAN_DAY_HAS_HISTORY (day with history removed without forceRemoveDays)',
|
||
},
|
||
},
|
||
},
|
||
delete: {
|
||
tags: ['Plans'],
|
||
summary:
|
||
'Delete a plan (any status). Cascades weeks, days, exercises, sets and sessions — for an active plan this also removes the training history and frees the single-active-plan slot',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
responses: {
|
||
204: { description: 'Deleted' },
|
||
404: { description: 'Plan not found or caller is not the owner' },
|
||
},
|
||
},
|
||
},
|
||
'/plans/{id}/days/{dayId}/move': {
|
||
patch: {
|
||
tags: ['Plans'],
|
||
summary:
|
||
"Move a training day of an ACTIVE plan — postpone it, pull it forward, or swap it with the day that occupies the target date (swapWithDayId). A SKIPPED day returns to PLANNED; every move (including the swapped day) is written to the day's move log with the optional reason",
|
||
description: 'Writes an ActivityLog entry: plan.day.moved.',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{ name: 'id', in: 'path', required: true, schema: { type: 'string' } },
|
||
{ name: 'dayId', in: 'path', required: true, schema: { type: 'string' } },
|
||
],
|
||
requestBody: {
|
||
required: true,
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
required: ['date'],
|
||
properties: {
|
||
date: {
|
||
type: 'string',
|
||
description: 'YYYY-MM-DD, not earlier than today nor the plan start date',
|
||
},
|
||
reason: { type: 'string', nullable: true, maxLength: 200 },
|
||
swapWithDayId: {
|
||
type: 'string',
|
||
description: 'Day occupying the target date to swap dates with',
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
responses: {
|
||
200: { description: 'OK, returns { day, swappedWith }' },
|
||
400: {
|
||
description:
|
||
'Plan is not active / completed day / training in progress / date in the past / nothing to swap with',
|
||
},
|
||
404: { description: 'Plan or day not found' },
|
||
409: {
|
||
description: 'Target date already holds another planned training — send swapWithDayId',
|
||
},
|
||
},
|
||
},
|
||
},
|
||
'/plans/{id}/days/{dayId}/skip/accept': {
|
||
post: {
|
||
tags: ['Plans'],
|
||
summary:
|
||
'Accept a SKIPPED training day of an ACTIVE plan (owner only) — the day stays SKIPPED and the decision dialog no longer shows it. Idempotent: an already-resolved day is returned unchanged',
|
||
description: 'Writes an ActivityLog entry: plan.day.skip.accepted.',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{ name: 'id', in: 'path', required: true, schema: { type: 'string' } },
|
||
{ name: 'dayId', in: 'path', required: true, schema: { type: 'string' } },
|
||
],
|
||
responses: {
|
||
200: { description: 'OK, returns { day }' },
|
||
400: { description: 'The day is not skipped' },
|
||
404: { description: 'Plan or day not found' },
|
||
},
|
||
},
|
||
},
|
||
'/plans/{id}/gym': {
|
||
patch: {
|
||
tags: ['Plans'],
|
||
summary:
|
||
"Change the informational gym of a plan (owner only, any status). Used by the 'start training' presence modal when the user shows up at a different gym than the plan points to. Requires membership of the target gym.",
|
||
description: 'Writes an ActivityLog entry: plan.gym.updated.',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
requestBody: {
|
||
required: true,
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
required: ['gymId'],
|
||
properties: { gymId: { type: 'string', nullable: true } },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
responses: {
|
||
200: { description: 'OK, returns { plan: { id, gym } }' },
|
||
400: { description: 'Unknown gymId / owner is not a member of the gym' },
|
||
404: { description: 'Plan not found or caller is not the owner' },
|
||
},
|
||
},
|
||
},
|
||
'/plans/{id}/activate': {
|
||
post: {
|
||
tags: ['Plans'],
|
||
summary: 'Activate plan (startDate must be a Monday of the current or a future week)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
requestBody: {
|
||
required: true,
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
required: ['startDate'],
|
||
properties: { startDate: { type: 'string' } },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
'/plans/{id}/abandon': {
|
||
post: {
|
||
tags: ['Plans'],
|
||
summary: 'Abandon plan (only from ACTIVE status)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
responses: {
|
||
200: { description: 'OK' },
|
||
400: { description: 'Only an active plan can be abandoned' },
|
||
404: { description: 'Plan not found' },
|
||
},
|
||
},
|
||
},
|
||
'/plans/{id}/complete': {
|
||
post: {
|
||
tags: ['Plans'],
|
||
summary:
|
||
'Manually archive plan (only from ACTIVE status and only when no training day is still planned; an in-progress plan can only be abandoned)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
responses: {
|
||
200: { description: 'OK' },
|
||
400: {
|
||
description: 'Only an active plan can be completed / plan has pending training days',
|
||
},
|
||
404: { description: 'Plan not found' },
|
||
},
|
||
},
|
||
},
|
||
'/plans/{id}/reopen': {
|
||
post: {
|
||
tags: ['Plans'],
|
||
summary:
|
||
'Reopen a completed or abandoned plan (back to ACTIVE; skipped days are not revived)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
responses: {
|
||
200: { description: 'OK' },
|
||
400: { description: 'Only a completed or abandoned plan can be reopened' },
|
||
404: { description: 'Plan not found' },
|
||
409: { description: 'User already has an active plan' },
|
||
},
|
||
},
|
||
},
|
||
'/plans/{id}/suspend': {
|
||
post: {
|
||
tags: ['Plans'],
|
||
summary:
|
||
'Suspend an active plan (ACTIVE -> SUSPENDED). Days stay planned and do not auto-expire while suspended; frees the "one active plan" slot. Blocked while a session of this plan is in progress',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
responses: {
|
||
200: { description: 'OK' },
|
||
400: {
|
||
description: 'Only an active plan can be suspended / training in progress',
|
||
},
|
||
404: { description: 'Plan not found or caller is not the owner' },
|
||
},
|
||
},
|
||
},
|
||
'/plans/{id}/resume': {
|
||
post: {
|
||
tags: ['Plans'],
|
||
summary:
|
||
'Resume a suspended plan (SUSPENDED -> ACTIVE). Planned days are kept: days dated today or later stay (current week), past PLANNED days shift forward by whole weeks (same weekday) into the first free slot — each shift is logged in the day move log. Skipped days stay skipped. Owner only',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
responses: {
|
||
200: { description: 'OK, returns { ok, title, movedDays }' },
|
||
400: { description: 'Only a suspended plan can be resumed' },
|
||
404: { description: 'Plan not found or caller is not the owner' },
|
||
409: { description: 'User already has an active plan' },
|
||
},
|
||
},
|
||
},
|
||
'/plans/{id}/share': {
|
||
post: {
|
||
tags: ['Plans'],
|
||
summary:
|
||
'Share the plan with a user in an ACTIVE coaching relation (trainer <-> trainee). Owner only; recipients get read-only access',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
requestBody: {
|
||
required: true,
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
required: ['userId'],
|
||
properties: { userId: { type: 'string' } },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
responses: {
|
||
201: { description: 'Shared' },
|
||
400: { description: 'Self-share / no active coaching relation' },
|
||
403: { description: 'Not the plan owner' },
|
||
404: { description: 'Plan not found' },
|
||
409: { description: 'Already shared with this user' },
|
||
},
|
||
},
|
||
},
|
||
'/plans/{id}/share/{userId}': {
|
||
delete: {
|
||
tags: ['Plans'],
|
||
summary: 'Revoke a plan share (owner only)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{ name: 'id', in: 'path', required: true, schema: { type: 'string' } },
|
||
{ name: 'userId', in: 'path', required: true, schema: { type: 'string' } },
|
||
],
|
||
responses: {
|
||
204: { description: 'Unshared' },
|
||
403: { description: 'Not the plan owner' },
|
||
404: { description: 'Plan not found / not shared with this user' },
|
||
},
|
||
},
|
||
},
|
||
'/days/{dayId}': {
|
||
get: {
|
||
tags: ['Sessions'],
|
||
summary:
|
||
'Training day details (status, date, sessions, exercises, plan with gym for the check-in modal)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'dayId', in: 'path', required: true, schema: { type: 'string' } }],
|
||
responses: {
|
||
200: { description: 'Day with sessions, exercises and plan (plan.gym may be null)' },
|
||
401: { description: 'Unauthorized' },
|
||
404: { description: 'Day not found' },
|
||
},
|
||
},
|
||
},
|
||
'/days/{dayId}/sessions': {
|
||
post: {
|
||
tags: ['Sessions'],
|
||
summary:
|
||
'Start session for a planned day (requires ACTIVE plan, one active session per user)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'dayId', in: 'path', required: true, schema: { type: 'string' } }],
|
||
responses: {
|
||
201: { description: 'Session started' },
|
||
400: { description: 'Training plan is not active / Day is not in planned state' },
|
||
404: { description: 'Day not found' },
|
||
409: { description: 'You already have an active session' },
|
||
},
|
||
},
|
||
},
|
||
'/sessions/{id}': {
|
||
get: {
|
||
tags: ['Sessions'],
|
||
summary: 'Session details (exercises -> sets, planned parameters as parent)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
},
|
||
},
|
||
'/sessions/{id}/exercises': {
|
||
post: {
|
||
tags: ['Sessions'],
|
||
summary: 'Add exercise to session (kept for restore)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
requestBody: {
|
||
required: true,
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
required: ['exerciseId'],
|
||
properties: { exerciseId: { type: 'string' } },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
'/sessions/exercises/{id}': {
|
||
patch: {
|
||
tags: ['Sessions'],
|
||
summary:
|
||
'Hide or remove exercise (data kept for restore); removing allowed only for exercises added to the session',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
requestBody: {
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
properties: { hidden: { type: 'boolean' }, removed: { type: 'boolean' } },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
responses: {
|
||
200: { description: 'OK' },
|
||
400: { description: 'Only exercises added to the session can be removed' },
|
||
404: { description: 'Session exercise not found' },
|
||
},
|
||
},
|
||
},
|
||
'/sessions/exercises/{id}/sets': {
|
||
post: {
|
||
tags: ['Sessions'],
|
||
summary:
|
||
"Add extra (bonus) set to session exercise (requires this exercise's planned sets recorded; at most one pending extra per exercise)",
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
},
|
||
},
|
||
'/sessions/sets/{id}': {
|
||
patch: {
|
||
tags: ['Sessions'],
|
||
summary: 'Record actual set results (reps, RIR, difficulty, note)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
requestBody: {
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
properties: {
|
||
reps: { type: 'integer', nullable: true },
|
||
rir: { type: 'integer', nullable: true },
|
||
difficulty: { type: 'integer', nullable: true },
|
||
note: { type: 'string', nullable: true },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
'/sessions/{id}/complete': {
|
||
post: {
|
||
tags: ['Sessions'],
|
||
summary:
|
||
'Complete session (requires all sets recorded; day -> completed). Returns { ok, summary: { durationSec, exercises, sets, bonusSets, reps, tonnageKg|null, killstreak: { current, best, newRecord, sampleSize, beatCount }, volume: { ownAvgKg|null, ownAvgSessions, globalAvgKg|null, globalSample } } | null } — summary feeds the post-workout celebration modal (null = non-critical failure)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
responses: {
|
||
200: { description: 'OK — { ok: true, summary }' },
|
||
400: { description: 'Session not in progress or planned/bonus sets still pending' },
|
||
},
|
||
},
|
||
},
|
||
'/sessions/{id}/abandon': {
|
||
post: {
|
||
tags: ['Sessions'],
|
||
summary:
|
||
'Abandon session (data kept, day -> skipped, the training cannot be executed again)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
},
|
||
},
|
||
'/sessions/{id}/reopen': {
|
||
post: {
|
||
tags: ['Sessions'],
|
||
summary:
|
||
'Reopen completed session (naprawa pomyłki; session -> in progress, day -> planned; requires no other active session)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
},
|
||
},
|
||
'/dashboard': {
|
||
get: {
|
||
tags: ['Dashboard'],
|
||
summary:
|
||
'Dashboard — killstreak (+ rekord, daty skutecznych dni z 30 ostatnich), globalna historia (plany/sesje/serie, pierwsza/ostatnia sesja, serie wg tygodni), tempo tygodnia i postęp aktywnego planu; pendingSkip: najnowsze nierozstrzygnięte pominięcie aktywnego planu (dialog decyzji) lub null',
|
||
security: [{ bearerAuth: [] }],
|
||
},
|
||
},
|
||
'/calendar': {
|
||
get: {
|
||
tags: ['Calendar'],
|
||
summary:
|
||
'Calendar — training days of the active plan in a month (each day carries planId, planTitle and the number of moves, so the client can move it via PATCH /plans/{id}/days/{dayId}/move)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{
|
||
name: 'month',
|
||
in: 'query',
|
||
schema: { type: 'string' },
|
||
description: 'YYYY-MM (default: current)',
|
||
},
|
||
],
|
||
},
|
||
},
|
||
'/admin/gyms/{id}/equipment-usage': {
|
||
get: {
|
||
tags: ['Admin'],
|
||
summary:
|
||
'Equipment usage heatmap of a gym (admin): rows = equipment, 24 hourly cells aggregated from sessions started within presence windows (default range: last 30 days)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{ name: 'id', in: 'path', required: true, schema: { type: 'string' } },
|
||
{ name: 'from', in: 'query', schema: { type: 'string', format: 'date-time' } },
|
||
{ name: 'to', in: 'query', schema: { type: 'string', format: 'date-time' } },
|
||
],
|
||
responses: {
|
||
200: {
|
||
description:
|
||
'OK, returns { equipment: [{ equipmentId, name, nameEn, cells: [{ hour, count }], peak }] } (sorted by total uses desc)',
|
||
},
|
||
404: { description: 'Gym not found' },
|
||
},
|
||
},
|
||
},
|
||
'/admin/gyms': {
|
||
get: {
|
||
tags: ['Admin'],
|
||
summary:
|
||
'List gyms (admin). Query: q (matches name/location/city/address/postal code/owner name or email), kind (REAL|VIRTUAL). Each gym includes owners[] (OWNER members) and _count.memberships.',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{
|
||
name: 'q',
|
||
in: 'query',
|
||
required: false,
|
||
schema: { type: 'string', maxLength: 200 },
|
||
},
|
||
{
|
||
name: 'kind',
|
||
in: 'query',
|
||
required: false,
|
||
schema: { type: 'string', enum: ['REAL', 'VIRTUAL'] },
|
||
},
|
||
],
|
||
},
|
||
post: {
|
||
tags: ['Admin'],
|
||
summary: 'Create REAL gym (admin; ownerId becomes OWNER member, address required)',
|
||
description: 'Writes an ActivityLog entry: gym.created.',
|
||
security: [{ bearerAuth: [] }],
|
||
requestBody: {
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
required: ['name', 'ownerId', 'addressLine1', 'postalCode', 'city'],
|
||
properties: {
|
||
name: { type: 'string' },
|
||
ownerId: { type: 'string', description: 'User mianowany właścicielem (OWNER)' },
|
||
addressLine1: {
|
||
type: 'string',
|
||
description: 'Ulica i numer, np. Mokotowska 12A',
|
||
},
|
||
addressLine2: {
|
||
type: 'string',
|
||
nullable: true,
|
||
description: 'Lokal/piętro itp.',
|
||
},
|
||
postalCode: { type: 'string', description: 'Kod pocztowy 00-001' },
|
||
city: { type: 'string' },
|
||
countryCode: { type: 'string', default: 'PL', description: 'ISO 3166-1 alpha-2' },
|
||
location: {
|
||
type: 'string',
|
||
description:
|
||
'Pole derivowane z adresu (ulica, kod miasto[, kraj]) — nie do zapisu',
|
||
},
|
||
availability: {
|
||
type: 'array',
|
||
description: '7 dni (Pon-Niedz), każdy null lub { start, end }',
|
||
items: {
|
||
type: 'object',
|
||
nullable: true,
|
||
properties: { start: { type: 'string' }, end: { type: 'string' } },
|
||
},
|
||
},
|
||
capacity: { type: 'integer' },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
'/admin/gyms/{id}/owners': {
|
||
post: {
|
||
tags: ['Admin'],
|
||
summary: 'Grant the OWNER role to a user in a gym (admin)',
|
||
description: 'Writes an ActivityLog entry: gym.owner.granted.',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
requestBody: {
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
required: ['userId'],
|
||
properties: { userId: { type: 'string' } },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
'/admin/gyms/{id}/owners/{userId}': {
|
||
delete: {
|
||
tags: ['Admin'],
|
||
summary: 'Revoke the OWNER role in a gym (admin; membership removed when no roles left)',
|
||
description: 'Writes an ActivityLog entry: gym.owner.revoked.',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{ name: 'id', in: 'path', required: true, schema: { type: 'string' } },
|
||
{ name: 'userId', in: 'path', required: true, schema: { type: 'string' } },
|
||
],
|
||
},
|
||
},
|
||
'/admin/gyms/{id}/logs': {
|
||
get: {
|
||
tags: ['Admin'],
|
||
summary:
|
||
"Audit log of one gym (admin) — gym.* entries, membership.* tied to this gym (details.gymId) and this gym's claims/invitations",
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{ name: 'id', in: 'path', required: true, schema: { type: 'string' } },
|
||
{
|
||
name: 'limit',
|
||
in: 'query',
|
||
required: false,
|
||
schema: { type: 'integer', minimum: 1, maximum: 500, default: 50 },
|
||
},
|
||
{
|
||
name: 'offset',
|
||
in: 'query',
|
||
required: false,
|
||
schema: { type: 'integer', minimum: 0, default: 0 },
|
||
},
|
||
],
|
||
responses: {
|
||
200: { description: 'OK, returns { logs, total }' },
|
||
404: { description: 'Gym not found' },
|
||
},
|
||
},
|
||
},
|
||
'/admin/gyms/{id}/members': {
|
||
get: {
|
||
tags: ['Admin'],
|
||
summary:
|
||
'Members of one gym (admin) — OWNER first, then by join date; roles, joinedAt, account status, checkedInNow',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{ name: 'id', in: 'path', required: true, schema: { type: 'string' } },
|
||
{ name: 'q', in: 'query', required: false, schema: { type: 'string', maxLength: 200 } },
|
||
{
|
||
name: 'role',
|
||
in: 'query',
|
||
required: false,
|
||
schema: { type: 'string', enum: ['OWNER', 'TRAINER', 'MEMBER'] },
|
||
},
|
||
{
|
||
name: 'limit',
|
||
in: 'query',
|
||
required: false,
|
||
schema: { type: 'integer', minimum: 1, maximum: 200, default: 50 },
|
||
},
|
||
{
|
||
name: 'offset',
|
||
in: 'query',
|
||
required: false,
|
||
schema: { type: 'integer', minimum: 0, default: 0 },
|
||
},
|
||
],
|
||
responses: {
|
||
200: { description: 'OK, returns { members, total }' },
|
||
404: { description: 'Gym not found' },
|
||
},
|
||
},
|
||
},
|
||
'/admin/gyms/{id}/related': {
|
||
get: {
|
||
tags: ['Admin'],
|
||
summary: 'Claims and invitations tied to one gym (admin), newest first',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
responses: {
|
||
200: { description: 'OK, returns { claims, invitations }' },
|
||
404: { description: 'Gym not found' },
|
||
},
|
||
},
|
||
},
|
||
'/admin/gyms/{id}/exceptions': {
|
||
get: {
|
||
tags: ['Admin'],
|
||
summary: "List a gym's schedule exceptions (admin)",
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
},
|
||
post: {
|
||
tags: ['Admin'],
|
||
summary: 'Add a one-off schedule exception (admin)',
|
||
description: 'Writes an ActivityLog entry: gym.exception.added.',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
requestBody: {
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
required: ['date'],
|
||
properties: {
|
||
date: { type: 'string', description: 'YYYY-MM-DD' },
|
||
availability: {
|
||
type: 'object',
|
||
nullable: true,
|
||
description: 'null = closed, { start, end } = different hours',
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
'/admin/gyms/{id}/exceptions/{exceptionId}': {
|
||
delete: {
|
||
tags: ['Admin'],
|
||
summary: 'Remove a schedule exception (admin)',
|
||
description: 'Writes an ActivityLog entry: gym.exception.removed.',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{ name: 'id', in: 'path', required: true, schema: { type: 'string' } },
|
||
{ name: 'exceptionId', in: 'path', required: true, schema: { type: 'string' } },
|
||
],
|
||
},
|
||
},
|
||
'/admin/gyms/{id}': {
|
||
patch: {
|
||
tags: ['Admin'],
|
||
summary: 'Update gym (admin; address fields recompute derived location)',
|
||
description: 'Writes an ActivityLog entry: gym.updated.',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
requestBody: {
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
properties: {
|
||
name: { type: 'string' },
|
||
addressLine1: { type: 'string', nullable: true },
|
||
addressLine2: { type: 'string', nullable: true },
|
||
postalCode: {
|
||
type: 'string',
|
||
nullable: true,
|
||
description: 'Kod pocztowy 00-001',
|
||
},
|
||
city: { type: 'string', nullable: true },
|
||
countryCode: {
|
||
type: 'string',
|
||
nullable: true,
|
||
description: 'ISO 3166-1 alpha-2',
|
||
},
|
||
availability: {
|
||
type: 'array',
|
||
nullable: true,
|
||
items: { type: 'object', nullable: true },
|
||
},
|
||
capacity: { type: 'integer', nullable: true },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
delete: {
|
||
tags: ['Admin'],
|
||
summary: 'Delete gym (admin; memberships removed, plans kept)',
|
||
description: 'Writes an ActivityLog entry: gym.deleted.',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
},
|
||
},
|
||
'/admin/users': {
|
||
get: {
|
||
tags: ['Admin'],
|
||
summary: 'List users (admin, optional ?search=)',
|
||
security: [{ bearerAuth: [] }],
|
||
},
|
||
post: {
|
||
tags: ['Admin'],
|
||
summary: 'Create user (admin)',
|
||
description:
|
||
'Writes an ActivityLog entry: user.created (details: email, isAdmin — never the password).',
|
||
security: [{ bearerAuth: [] }],
|
||
requestBody: {
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
required: ['email', 'password'],
|
||
properties: {
|
||
email: { type: 'string' },
|
||
password: { type: 'string' },
|
||
firstName: { type: 'string' },
|
||
lastName: { type: 'string' },
|
||
birthDate: { type: 'string', format: 'date', nullable: true },
|
||
isAdmin: { type: 'boolean' },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
'/admin/users/{id}': {
|
||
patch: {
|
||
tags: ['Admin'],
|
||
summary:
|
||
'Update user (admin; role or status change revokes JWT via token_version). ' +
|
||
'Status: SUSPENDED requires future suspensionUntil, BANNED requires restrictionReason; ACTIVE clears both',
|
||
description:
|
||
'Writes ActivityLog entries by body content: user.updated (field names only), ' +
|
||
'user.status.changed (status/suspensionUntil/restrictionReason), user.admin.changed (isAdmin). Never logs the password.',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
},
|
||
delete: {
|
||
tags: ['Admin'],
|
||
summary: 'Delete user (admin; plans/sessions cascade-deleted)',
|
||
description:
|
||
'Writes an ActivityLog entry: user.deleted (details: email — the account is gone).',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
},
|
||
},
|
||
'/admin/users/{id}/memberships': {
|
||
post: {
|
||
tags: ['Admin'],
|
||
summary: 'Assign gym membership with roles (admin)',
|
||
description:
|
||
'Writes an ActivityLog entry: membership.created (details: userId, gymId, roles).',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
requestBody: {
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
required: ['gymId', 'roles'],
|
||
properties: {
|
||
gymId: { type: 'string' },
|
||
roles: {
|
||
type: 'array',
|
||
items: { type: 'string', enum: ['OWNER', 'TRAINER', 'MEMBER'] },
|
||
minItems: 1,
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
'/admin/users/{id}/memberships/{gymId}': {
|
||
patch: {
|
||
tags: ['Admin'],
|
||
summary: 'Change gym membership roles (admin)',
|
||
description:
|
||
'Writes an ActivityLog entry: membership.updated (details: userId, gymId, roles).',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{ name: 'id', in: 'path', required: true, schema: { type: 'string' } },
|
||
{ name: 'gymId', in: 'path', required: true, schema: { type: 'string' } },
|
||
],
|
||
requestBody: {
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
required: ['roles'],
|
||
properties: {
|
||
roles: {
|
||
type: 'array',
|
||
items: { type: 'string', enum: ['OWNER', 'TRAINER', 'MEMBER'] },
|
||
minItems: 1,
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
delete: {
|
||
tags: ['Admin'],
|
||
summary: 'Remove gym membership (admin)',
|
||
description:
|
||
'Writes an ActivityLog entry: membership.deleted (details: userId, gymId, roles, optional reason).',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{ name: 'id', in: 'path', required: true, schema: { type: 'string' } },
|
||
{ name: 'gymId', in: 'path', required: true, schema: { type: 'string' } },
|
||
],
|
||
requestBody: {
|
||
required: false,
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
properties: {
|
||
reason: { type: 'string', minLength: 3, maxLength: 300 },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
'/admin/users/{id}/killstreak': {
|
||
get: {
|
||
tags: ['Admin'],
|
||
summary: "User's killstreak (admin)",
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
responses: { 200: { description: 'OK' }, 404: { description: 'User not found' } },
|
||
},
|
||
},
|
||
'/admin/users/{id}/body-parameters': {
|
||
get: {
|
||
tags: ['Admin'],
|
||
summary: "User's body parameters over time (admin)",
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
responses: { 200: { description: 'OK' }, 404: { description: 'User not found' } },
|
||
},
|
||
},
|
||
'/admin/users/{id}/body-parameters/weight': {
|
||
post: {
|
||
tags: ['Admin'],
|
||
summary: 'Add weight measurement for user (admin)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
requestBody: {
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
required: ['value'],
|
||
properties: {
|
||
value: { type: 'number' },
|
||
date: { type: 'string', format: 'date-time' },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
'/admin/users/{id}/body-parameters/weight/{measurementId}': {
|
||
delete: {
|
||
tags: ['Admin'],
|
||
summary: 'Delete a weight measurement of user (admin)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{ name: 'id', in: 'path', required: true, schema: { type: 'string' } },
|
||
{ name: 'measurementId', in: 'path', required: true, schema: { type: 'string' } },
|
||
],
|
||
},
|
||
},
|
||
'/admin/users/{id}/body-parameters/circumference': {
|
||
post: {
|
||
tags: ['Admin'],
|
||
summary: 'Add circumference measurement for user (admin)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
requestBody: {
|
||
content: {
|
||
'application/json': {
|
||
schema: {
|
||
type: 'object',
|
||
required: ['typeId', 'value'],
|
||
properties: {
|
||
typeId: {
|
||
type: 'string',
|
||
enum: ['chest', 'waist', 'hips', 'neck', 'biceps', 'forearm', 'thigh', 'calf'],
|
||
},
|
||
side: { type: 'string', enum: ['left', 'right'], nullable: true },
|
||
value: { type: 'number' },
|
||
date: { type: 'string', format: 'date-time' },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
'/admin/users/{id}/body-parameters/circumference/{measurementId}': {
|
||
delete: {
|
||
tags: ['Admin'],
|
||
summary: 'Delete a circumference measurement of user (admin)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{ name: 'id', in: 'path', required: true, schema: { type: 'string' } },
|
||
{ name: 'measurementId', in: 'path', required: true, schema: { type: 'string' } },
|
||
],
|
||
},
|
||
},
|
||
'/admin/users/{id}/history': {
|
||
get: {
|
||
tags: ['Admin'],
|
||
summary: "User's training history (admin, optional ?month=YYYY-MM)",
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{ name: 'id', in: 'path', required: true, schema: { type: 'string' } },
|
||
{ name: 'month', in: 'query', required: false, schema: { type: 'string' } },
|
||
],
|
||
},
|
||
},
|
||
'/admin/users/{id}/exercise-progress': {
|
||
get: {
|
||
tags: ['Admin'],
|
||
summary: "User's per-exercise progress — 1RM Epley + volume (admin)",
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||
},
|
||
},
|
||
'/admin/users/{id}/activity': {
|
||
get: {
|
||
tags: ['Admin'],
|
||
summary:
|
||
'Account history — audit entries performed on the user: logins (IP), edits, bans/suspensions, admin role, creation/deletion (admin)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [
|
||
{ name: 'id', in: 'path', required: true, schema: { type: 'string' } },
|
||
{
|
||
name: 'limit',
|
||
in: 'query',
|
||
required: false,
|
||
schema: { type: 'integer', minimum: 1, maximum: 500, default: 50 },
|
||
},
|
||
{
|
||
name: 'offset',
|
||
in: 'query',
|
||
required: false,
|
||
schema: { type: 'integer', minimum: 0, default: 0 },
|
||
},
|
||
],
|
||
responses: {
|
||
200: { description: 'OK — { logs, total }, newest first' },
|
||
404: { description: 'User not found' },
|
||
},
|
||
},
|
||
},
|
||
'/trainer/trainees/{userId}/report': {
|
||
get: {
|
||
tags: ['Trainer'],
|
||
summary:
|
||
'Plan vs. actual per muscle group + recommended volume range + plan days + exercise-level detail (trainer only)',
|
||
security: [{ bearerAuth: [] }],
|
||
parameters: [{ name: 'userId', in: 'path', required: true, schema: { type: 'string' } }],
|
||
responses: {
|
||
200: {
|
||
description: 'OK',
|
||
content: {
|
||
'application/json': {
|
||
schema: { $ref: '#/components/schemas/TraineeReport' },
|
||
},
|
||
},
|
||
},
|
||
404: { description: 'Trainee not found' },
|
||
},
|
||
},
|
||
},
|
||
},
|
||
};
|