2026-09-04 19:06:19 +02:00
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' } ,
} ,
} ,
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' ,
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' } ,
2026-10-17 00:53:20 +02:00
403 : {
description :
'ACCOUNT_SUSPENDED (details: until, reason) or ACCOUNT_BANNED (details: reason)' ,
} ,
2026-09-04 19:06:19 +02:00
} ,
} ,
} ,
'/auth/refresh' : {
post : {
tags : [ 'Auth' ] ,
summary : 'Refresh access token (refresh cookie)' ,
responses : {
200 : { description : 'OK (accessToken)' } ,
401 : { description : 'Invalid/revoked refresh token' } ,
2026-10-17 00:53:20 +02:00
403 : {
description :
'ACCOUNT_SUSPENDED (details: until, reason) or ACCOUNT_BANNED (details: reason)' ,
} ,
2026-09-04 19:06:19 +02:00
} ,
} ,
} ,
'/auth/logout' : {
post : { tags : [ 'Auth' ] , summary : 'Logout (clears refresh cookie)' } ,
} ,
'/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' } ,
age : { type : 'integer' } ,
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/active-session' : {
get : {
tags : [ 'Sessions' ] ,
summary : 'Active (IN_PROGRESS) training session of the current user, if any' ,
security : [ { bearerAuth : [ ] } ] ,
} ,
} ,
2026-09-13 02:28:29 +02:00
'/me/trainers' : {
get : {
tags : [ 'Profile' ] ,
summary : 'My trainers (ACTIVE coaching relations where I am the trainee)' ,
security : [ { bearerAuth : [ ] } ] ,
} ,
} ,
2026-09-04 19:06:19 +02:00
'/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 : [ 'name' , 'value' ] ,
properties : {
name : { type : 'string' } ,
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' ] ,
2026-10-15 01:42:26 +02:00
summary :
'Create a gym (creator becomes OWNER; admins only for REAL, REAL requires address)' ,
2026-09-04 19:06:19 +02:00
security : [ { bearerAuth : [ ] } ] ,
requestBody : {
required : true ,
content : {
'application/json' : {
schema : {
type : 'object' ,
required : [ 'name' ] ,
properties : {
name : { type : 'string' } ,
2026-10-15 00:34:12 +02:00
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' } ,
2026-09-04 19:06:19 +02:00
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' ] ,
2026-10-17 08:36:16 +02:00
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)' ,
2026-09-04 19:06:19 +02:00
security : [ { bearerAuth : [ ] } ] ,
parameters : [ { name : 'gymId' , in : 'path' , required : true , schema : { type : 'string' } } ] ,
requestBody : {
required : true ,
content : {
'application/json' : {
schema : {
type : 'object' ,
required : [ 'equipmentId' ] ,
2026-10-17 08:36:16 +02:00
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}' ,
} ,
} ,
2026-09-04 19:06:19 +02:00
} ,
} ,
} ,
} ,
} ,
} ,
2026-10-17 08:36:16 +02:00
'/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' ,
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)' ,
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' } } ,
] ,
} ,
2026-09-04 19:06:19 +02:00
delete : {
tags : [ 'Gyms' ] ,
2026-10-17 08:36:16 +02:00
summary : 'Remove a photo from an equipment instance (owner or admin)' ,
2026-09-04 19:06:19 +02:00
security : [ { bearerAuth : [ ] } ] ,
parameters : [
{ name : 'gymId' , in : 'path' , required : true , schema : { type : 'string' } } ,
2026-10-17 08:36:16 +02:00
{ name : 'id' , in : 'path' , required : true , schema : { type : 'string' } } ,
{ name : 'photoId' , in : 'path' , required : true , schema : { type : 'string' } } ,
2026-09-04 19:06:19 +02:00
] ,
} ,
} ,
'/gyms/{gymId}' : {
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)' ,
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)' ,
security : [ { bearerAuth : [ ] } ] ,
parameters : [
{ name : 'gymId' , in : 'path' , required : true , schema : { type : 'string' } } ,
{ name : 'exceptionId' , in : 'path' , required : true , schema : { type : 'string' } } ,
] ,
} ,
} ,
2026-10-15 02:12:22 +02:00
'/gyms/{gymId}/announcements' : {
get : {
tags : [ 'Gyms' ] ,
summary : "List the gym's announcements (any member; canManage = OWNER)" ,
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)" ,
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)' ,
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)' ,
security : [ { bearerAuth : [ ] } ] ,
parameters : [
{ name : 'gymId' , in : 'path' , required : true , schema : { type : 'string' } } ,
{ name : 'announcementId' , in : 'path' , required : true , schema : { type : 'string' } } ,
] ,
} ,
} ,
'/me/feed' : {
get : {
tags : [ 'Feed' ] ,
summary :
'Merged feed of personal notifications and gym/global announcements (cursor = createdAt)' ,
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}/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' } } ] ,
} ,
} ,
2026-09-04 19:06:19 +02:00
'/admin/equipment' : {
get : {
tags : [ 'Equipment' ] ,
2026-10-14 05:44:14 +02:00
summary : 'List the equipment (machine/device) catalog with usage counts (admin)' ,
2026-09-04 19:06:19 +02:00
security : [ { bearerAuth : [ ] } ] ,
} ,
post : {
tags : [ 'Equipment' ] ,
summary : 'Create an equipment catalog entry (admin)' ,
security : [ { bearerAuth : [ ] } ] ,
requestBody : {
required : true ,
content : {
'application/json' : {
schema : {
type : 'object' ,
required : [ 'name' ] ,
2026-09-12 15:16:13 +02:00
properties : {
name : { type : 'string' } ,
description : { type : 'string' , nullable : true } ,
} ,
2026-09-04 19:06:19 +02:00
} ,
} ,
} ,
} ,
} ,
} ,
'/admin/equipment/{id}' : {
patch : {
tags : [ 'Equipment' ] ,
summary : 'Update an equipment catalog entry (admin)' ,
security : [ { bearerAuth : [ ] } ] ,
parameters : [ { name : 'id' , in : 'path' , required : true , schema : { type : 'string' } } ] ,
} ,
delete : {
tags : [ 'Equipment' ] ,
summary : 'Delete an equipment catalog entry (admin)' ,
security : [ { bearerAuth : [ ] } ] ,
parameters : [ { name : 'id' , in : 'path' , required : true , schema : { type : 'string' } } ] ,
} ,
} ,
'/admin/exercises' : {
get : {
tags : [ 'Exercises' ] ,
2026-10-14 05:44:14 +02:00
summary : 'List exercise types with linked equipment and plan-usage count (admin)' ,
2026-09-04 19:06:19 +02:00
security : [ { bearerAuth : [ ] } ] ,
} ,
post : {
tags : [ 'Exercises' ] ,
2026-10-14 05:44:14 +02:00
summary :
'Create an exercise type (admin). Optional has* flags override the default strength combination.' ,
2026-09-04 19:06:19 +02:00
security : [ { bearerAuth : [ ] } ] ,
2026-10-14 05:44:14 +02:00
requestBody : {
required : true ,
content : {
'application/json' : {
schema : {
type : 'object' ,
required : [ 'name' , 'primaryMuscle' ] ,
properties : {
name : { type : 'string' } ,
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' } ,
} ,
} ,
} ,
} ,
} ,
2026-09-04 19:06:19 +02:00
} ,
} ,
'/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' ] ,
2026-10-14 05:44:14 +02:00
summary :
'Update an exercise type (admin). equipmentIds replaces the linked set; has* flags optional.' ,
2026-09-04 19:06:19 +02:00
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.' ,
security : [ { bearerAuth : [ ] } ] ,
parameters : [ { name : 'id' , in : 'path' , required : true , schema : { type : 'string' } } ] ,
} ,
} ,
2026-10-15 02:12:22 +02:00
'/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)' ,
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)' ,
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)' ,
security : [ { bearerAuth : [ ] } ] ,
parameters : [ { name : 'id' , in : 'path' , required : true , schema : { type : 'string' } } ] ,
} ,
} ,
2026-10-14 05:44:14 +02:00
'/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.' ,
security : [ { bearerAuth : [ ] } ] ,
requestBody : {
required : true ,
content : {
'application/json' : {
schema : {
type : 'object' ,
required : [ 'name' , 'muscle' ] ,
properties : {
name : { type : 'string' } ,
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.' ,
security : [ { bearerAuth : [ ] } ] ,
parameters : [ { name : 'id' , in : 'path' , required : true , schema : { type : 'string' } } ] ,
} ,
delete : {
tags : [ 'Admin' ] ,
summary : 'Delete a focus area (admin)' ,
security : [ { bearerAuth : [ ] } ] ,
parameters : [ { name : 'id' , in : 'path' , required : true , schema : { type : 'string' } } ] ,
} ,
} ,
2026-09-04 19:06:19 +02:00
'/admin/gyms/{id}/equipment' : {
post : {
tags : [ 'Admin' ] ,
2026-10-17 08:36:16 +02:00
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)' ,
2026-09-04 19:06:19 +02:00
security : [ { bearerAuth : [ ] } ] ,
parameters : [ { name : 'id' , in : 'path' , required : true , schema : { type : 'string' } } ] ,
requestBody : {
required : true ,
content : {
'application/json' : {
schema : {
type : 'object' ,
required : [ 'equipmentId' ] ,
2026-10-17 08:36:16 +02:00
properties : {
equipmentId : { type : 'string' } ,
quantity : { type : 'integer' , minimum : 1 , maximum : 10000 } ,
spec : { type : 'object' , nullable : true } ,
} ,
2026-09-04 19:06:19 +02:00
} ,
} ,
} ,
} ,
} ,
} ,
2026-10-17 08:36:16 +02:00
'/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' ,
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 } ,
} ,
} ,
} ,
} ,
} ,
} ,
2026-09-04 19:06:19 +02:00
delete : {
tags : [ 'Admin' ] ,
2026-10-17 08:36:16 +02:00
summary : 'Remove an equipment instance (and its photos) from a gym (admin)' ,
2026-09-04 19:06:19 +02:00
security : [ { bearerAuth : [ ] } ] ,
parameters : [
{ name : 'id' , in : 'path' , required : true , schema : { type : 'string' } } ,
2026-10-17 08:36:16 +02:00
{ name : 'instanceId' , in : 'path' , required : true , schema : { type : 'string' } } ,
2026-09-04 19:06:19 +02:00
] ,
} ,
} ,
'/plans' : {
get : {
tags : [ 'Plans' ] ,
summary : "User's plans" ,
security : [ { bearerAuth : [ ] } ] ,
} ,
post : {
tags : [ 'Plans' ] ,
summary :
2026-09-13 18:20:56 +02:00
'Create plan: weeks -> days (dayOfWeek) -> exercises -> sets. Optional startDate (a Monday) creates and activates the plan in one step. Creation is always allowed; when the user already has an active plan the new plan stays a DRAFT and the response carries activationSkipped: true. Optional gymId (informational; the plan owner must be a gym member) and per-week customName (alias, max 40)' ,
2026-09-04 19:06:19 +02:00
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 } ,
2026-09-12 15:16:13 +02:00
gymId : {
type : 'string' ,
nullable : true ,
description : 'Informational gym; the plan owner must be a member of it' ,
} ,
2026-09-04 19:06:19 +02:00
startDate : {
type : 'string' ,
description : 'YYYY-MM-DD, must be a Monday of the current or a future week' ,
} ,
weeks : {
type : 'array' ,
items : {
type : 'object' ,
required : [ 'index' , 'days' ] ,
properties : {
index : { type : 'integer' , minimum : 0 } ,
2026-09-12 15:16:13 +02:00
customName : { type : 'string' , nullable : true , maxLength : 40 } ,
2026-09-04 19:06:19 +02:00
days : {
type : 'array' ,
items : {
type : 'object' ,
required : [ 'dayOfWeek' , 'exercises' ] ,
properties : {
dayOfWeek : { type : 'integer' , minimum : 1 , maximum : 7 } ,
exercises : {
type : 'array' ,
items : {
type : 'object' ,
required : [ 'exerciseId' , 'order' , 'sets' ] ,
properties : {
exerciseId : { type : 'string' } ,
order : { type : 'integer' , minimum : 0 } ,
sets : {
type : 'array' ,
items : {
type : 'object' ,
required : [ 'index' ] ,
properties : {
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 } ,
} ,
} ,
} ,
} ,
} ,
} ,
} ,
} ,
} ,
} ,
} ,
} ,
} ,
} ,
} ,
} ,
} ,
} ,
} ,
2026-09-13 02:28:29 +02:00
'/plans/shared-with-me' : {
get : {
tags : [ 'Plans' ] ,
summary : 'Plans explicitly shared with the user (read-only)' ,
security : [ { bearerAuth : [ ] } ] ,
} ,
} ,
2026-09-04 19:06:19 +02:00
'/plans/{id}' : {
get : {
tags : [ 'Plans' ] ,
2026-09-13 02:28:29 +02:00
summary :
'Plan details. Access: owner, trainer with an ACTIVE coaching relation, or a share recipient (read-only)' ,
2026-09-04 19:06:19 +02:00
security : [ { bearerAuth : [ ] } ] ,
parameters : [ { name : 'id' , in : 'path' , required : true , schema : { type : 'string' } } ] ,
} ,
patch : {
tags : [ 'Plans' ] ,
2026-09-12 15:16:13 +02:00
summary :
2026-09-13 18:20:56 +02:00
'Replace plan structure (draft only). Same body as POST /plans (gymId and weeks[].customName included). Optional startDate (a Monday of the current or a future week) updates and activates the plan in one step. The update is always allowed; when the user already has an active plan the structure is saved and the response carries activationSkipped: true' ,
2026-09-04 19:06:19 +02:00
security : [ { bearerAuth : [ ] } ] ,
parameters : [ { name : 'id' , in : 'path' , required : true , schema : { type : 'string' } } ] ,
2026-09-13 02:28:29 +02:00
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 / start date not a Monday / start week in the past' } ,
} ,
2026-09-04 19:06:19 +02:00
} ,
delete : {
tags : [ 'Plans' ] ,
summary : 'Delete plan (draft only)' ,
security : [ { bearerAuth : [ ] } ] ,
parameters : [ { name : 'id' , in : 'path' , required : true , schema : { type : 'string' } } ] ,
} ,
} ,
'/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' : {
2026-09-12 15:16:13 +02:00
schema : {
type : 'object' ,
required : [ 'startDate' ] ,
properties : { startDate : { type : 'string' } } ,
} ,
2026-09-04 19:06:19 +02:00
} ,
} ,
} ,
} ,
} ,
'/plans/{id}/abandon' : {
post : {
tags : [ 'Plans' ] ,
2026-10-11 16:34:47 +02:00
summary : 'Abandon plan (only from ACTIVE status)' ,
2026-09-04 19:06:19 +02:00
security : [ { bearerAuth : [ ] } ] ,
parameters : [ { name : 'id' , in : 'path' , required : true , schema : { type : 'string' } } ] ,
2026-10-11 16:34:47 +02:00
responses : {
200 : { description : 'OK' } ,
400 : { description : 'Only an active plan can be abandoned' } ,
404 : { description : 'Plan not found' } ,
} ,
2026-09-04 19:06:19 +02:00
} ,
} ,
'/plans/{id}/complete' : {
post : {
tags : [ 'Plans' ] ,
2026-10-15 01:42:26 +02:00
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)' ,
2026-09-04 19:06:19 +02:00
security : [ { bearerAuth : [ ] } ] ,
parameters : [ { name : 'id' , in : 'path' , required : true , schema : { type : 'string' } } ] ,
2026-10-11 16:34:47 +02:00
responses : {
200 : { description : 'OK' } ,
2026-10-15 01:42:26 +02:00
400 : {
description : 'Only an active plan can be completed / plan has pending training days' ,
} ,
2026-10-11 16:34:47 +02:00
404 : { description : 'Plan not found' } ,
} ,
2026-09-04 19:06:19 +02:00
} ,
} ,
2026-10-15 01:42:26 +02:00
'/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' } ,
} ,
} ,
} ,
2026-09-13 02:28:29 +02:00
'/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' } ,
} ,
} ,
} ,
2026-09-04 19:06:19 +02:00
'/days/{dayId}/sessions' : {
post : {
tags : [ 'Sessions' ] ,
2026-10-11 16:34:47 +02:00
summary :
'Start session for a planned day (requires ACTIVE plan, one active session per user)' ,
2026-09-04 19:06:19 +02:00
security : [ { bearerAuth : [ ] } ] ,
parameters : [ { name : 'dayId' , in : 'path' , required : true , schema : { type : 'string' } } ] ,
2026-10-11 16:34:47 +02:00
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' } ,
} ,
2026-09-04 19:06:19 +02:00
} ,
} ,
'/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' : {
2026-09-12 15:16:13 +02:00
schema : {
type : 'object' ,
required : [ 'exerciseId' ] ,
properties : { exerciseId : { type : 'string' } } ,
} ,
2026-09-04 19:06:19 +02:00
} ,
} ,
} ,
} ,
} ,
'/sessions/exercises/{id}' : {
patch : {
tags : [ 'Sessions' ] ,
2026-10-11 16:34:47 +02:00
summary :
'Hide or remove exercise (data kept for restore); removing allowed only for exercises added to the session' ,
2026-09-04 19:06:19 +02:00
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' } } ,
} ,
} ,
} ,
} ,
2026-10-11 16:34:47 +02:00
responses : {
200 : { description : 'OK' } ,
400 : { description : 'Only exercises added to the session can be removed' } ,
404 : { description : 'Session exercise not found' } ,
} ,
2026-09-04 19:06:19 +02:00
} ,
} ,
'/sessions/exercises/{id}/sets' : {
post : {
tags : [ 'Sessions' ] ,
2026-10-14 21:32:23 +02:00
summary :
2026-10-14 22:11:49 +02:00
"Add extra (bonus) set to session exercise (requires this exercise's planned sets recorded; at most one pending extra per exercise)" ,
2026-09-04 19:06:19 +02:00
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)' ,
security : [ { bearerAuth : [ ] } ] ,
parameters : [ { name : 'id' , in : 'path' , required : true , schema : { type : 'string' } } ] ,
} ,
} ,
'/sessions/{id}/abandon' : {
post : {
tags : [ 'Sessions' ] ,
2026-09-12 15:16:13 +02:00
summary :
'Abandon session (data kept, day -> skipped, the training cannot be executed again)' ,
2026-09-04 19:06:19 +02:00
security : [ { bearerAuth : [ ] } ] ,
parameters : [ { name : 'id' , in : 'path' , required : true , schema : { type : 'string' } } ] ,
} ,
} ,
2026-10-14 22:37:52 +02:00
'/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' } } ] ,
} ,
} ,
2026-09-04 19:06:19 +02:00
'/dashboard' : {
get : {
tags : [ 'Dashboard' ] ,
2026-10-15 02:47:42 +02:00
summary :
2026-10-17 05:09:59 +02:00
'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' ,
2026-09-04 19:06:19 +02:00
security : [ { bearerAuth : [ ] } ] ,
} ,
} ,
'/calendar' : {
get : {
tags : [ 'Calendar' ] ,
summary : 'Calendar — training days of the active plan in a month' ,
security : [ { bearerAuth : [ ] } ] ,
parameters : [
2026-09-12 15:16:13 +02:00
{
name : 'month' ,
in : 'query' ,
schema : { type : 'string' } ,
description : 'YYYY-MM (default: current)' ,
} ,
2026-09-04 19:06:19 +02:00
] ,
} ,
} ,
'/admin/gyms' : {
get : {
tags : [ 'Admin' ] ,
summary : 'List gyms (admin)' ,
security : [ { bearerAuth : [ ] } ] ,
} ,
post : {
tags : [ 'Admin' ] ,
2026-10-15 00:24:14 +02:00
summary : 'Create REAL gym (admin; ownerId becomes OWNER member, address required)' ,
2026-09-04 19:06:19 +02:00
security : [ { bearerAuth : [ ] } ] ,
requestBody : {
content : {
'application/json' : {
schema : {
type : 'object' ,
2026-10-15 00:24:14 +02:00
required : [ 'name' , 'ownerId' , 'addressLine1' , 'postalCode' , 'city' ] ,
2026-09-04 19:06:19 +02:00
properties : {
name : { type : 'string' } ,
2026-10-15 00:02:40 +02:00
ownerId : { type : 'string' , description : 'User mianowany właścicielem (OWNER)' } ,
2026-10-15 01:42:26 +02:00
addressLine1 : {
type : 'string' ,
description : 'Ulica i numer, np. Mokotowska 12A' ,
} ,
addressLine2 : {
type : 'string' ,
nullable : true ,
description : 'Lokal/piętro itp.' ,
} ,
2026-10-15 00:24:14 +02:00
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' ,
2026-10-15 01:42:26 +02:00
description :
'Pole derivowane z adresu (ulica, kod miasto[, kraj]) — nie do zapisu' ,
2026-10-15 00:24:14 +02:00
} ,
2026-09-04 19:06:19 +02:00
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' } ,
} ,
} ,
} ,
} ,
} ,
} ,
} ,
2026-10-15 00:02:40 +02:00
'/admin/gyms/{id}/owners' : {
post : {
tags : [ 'Admin' ] ,
summary : 'Grant the OWNER role to a user in a gym (admin)' ,
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)' ,
security : [ { bearerAuth : [ ] } ] ,
parameters : [
{ name : 'id' , in : 'path' , required : true , schema : { type : 'string' } } ,
{ name : 'userId' , in : 'path' , required : true , schema : { type : 'string' } } ,
] ,
} ,
} ,
2026-09-04 19:06:19 +02:00
'/admin/gyms/{id}' : {
patch : {
tags : [ 'Admin' ] ,
2026-10-15 00:24:14 +02:00
summary : 'Update gym (admin; address fields recompute derived location)' ,
2026-09-04 19:06:19 +02:00
security : [ { bearerAuth : [ ] } ] ,
parameters : [ { name : 'id' , in : 'path' , required : true , schema : { type : 'string' } } ] ,
2026-10-15 00:24:14 +02:00
requestBody : {
content : {
'application/json' : {
schema : {
type : 'object' ,
properties : {
name : { type : 'string' } ,
addressLine1 : { type : 'string' , nullable : true } ,
addressLine2 : { type : 'string' , nullable : true } ,
2026-10-15 01:42:26 +02:00
postalCode : {
type : 'string' ,
nullable : true ,
description : 'Kod pocztowy 00-001' ,
} ,
2026-10-15 00:24:14 +02:00
city : { type : 'string' , nullable : true } ,
2026-10-15 01:42:26 +02:00
countryCode : {
type : 'string' ,
nullable : true ,
description : 'ISO 3166-1 alpha-2' ,
} ,
availability : {
type : 'array' ,
nullable : true ,
items : { type : 'object' , nullable : true } ,
} ,
2026-10-15 00:24:14 +02:00
capacity : { type : 'integer' , nullable : true } ,
} ,
} ,
} ,
} ,
} ,
2026-09-04 19:06:19 +02:00
} ,
delete : {
tags : [ 'Admin' ] ,
summary : 'Delete gym (admin; memberships removed, plans kept)' ,
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)' ,
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' } ,
age : { type : 'integer' } ,
isAdmin : { type : 'boolean' } ,
} ,
} ,
} ,
} ,
} ,
} ,
} ,
'/admin/users/{id}' : {
patch : {
tags : [ 'Admin' ] ,
2026-10-17 00:53:20 +02:00
summary :
'Update user (admin; role or status change revokes JWT via token_version). ' +
'Status: SUSPENDED requires future suspensionUntil, BANNED requires restrictionReason; ACTIVE clears both' ,
2026-09-04 19:06:19 +02:00
security : [ { bearerAuth : [ ] } ] ,
parameters : [ { name : 'id' , in : 'path' , required : true , schema : { type : 'string' } } ] ,
} ,
delete : {
tags : [ 'Admin' ] ,
summary : 'Delete user (admin; plans/sessions cascade-deleted)' ,
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)' ,
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)' ,
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)' ,
security : [ { bearerAuth : [ ] } ] ,
parameters : [
{ name : 'id' , in : 'path' , required : true , schema : { type : 'string' } } ,
{ name : 'gymId' , in : 'path' , required : true , schema : { type : 'string' } } ,
] ,
} ,
} ,
2026-10-14 06:12:41 +02:00
'/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 : [ 'name' , 'value' ] ,
properties : {
name : { type : 'string' } ,
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' } } ] ,
} ,
} ,
2026-09-04 19:06:19 +02:00
} ,
} ;