| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
- get:
- summary: List all workouts for the current user
- operationId: listWorkouts
- tags:
- - Workouts
- security:
- - cookieAuth: []
- responses:
- '200':
- description: Array of workouts belonging to the authenticated user.
- content:
- application/json:
- schema:
- type: array
- items:
- type: object
- required:
- - id
- - name
- properties:
- id:
- type: string
- format: uuid
- example: 0191a23b-dead-7000-beef-000000000002
- name:
- type: string
- example: Push Day
- example:
- - id: 0191a23b-dead-7000-beef-000000000002
- name: Push Day
- - id: 0191a23b-dead-7000-beef-000000000005
- name: Pull Day
- '401':
- description: Missing or invalid auth token.
- content:
- application/json:
- schema:
- $ref: '../components/schemas/ErrorResponse.yaml'
- examples:
- missing:
- summary: No cookie present
- value:
- error: Missing auth token
- invalid:
- summary: Token invalid or expired
- value:
- error: Invalid auth token
- '500':
- description: Internal server error.
- content:
- application/json:
- schema:
- $ref: '../components/schemas/ErrorResponse.yaml'
- post:
- summary: Create a new workout
- operationId: createWorkout
- tags:
- - Workouts
- security:
- - cookieAuth: []
- requestBody:
- required: true
- content:
- application/json:
- schema:
- type: object
- required:
- - name
- - exercises
- properties:
- name:
- type: string
- example: Push Day
- exercises:
- type: array
- items:
- type: object
- required:
- - name
- - exercise_type
- - position
- properties:
- name:
- type: string
- example: Bench Press
- exercise_type:
- $ref: '../components/schemas/ExerciseType.yaml'
- position:
- type: integer
- description: 1-based position of the exercise within the workout.
- example: 1
- example:
- name: Push Day
- exercises:
- - name: Bench Press
- exercise_type: WeightedReps
- position: 1
- - name: Push-ups
- exercise_type: BodyweightReps
- position: 2
- - name: Treadmill
- exercise_type: Cardio
- position: 3
- responses:
- '201':
- description: Workout created successfully. Returns the full created workout, including generated IDs for the exercises.
- content:
- application/json:
- schema:
- type: object
- required:
- - id
- - name
- - exercises
- properties:
- id:
- type: string
- format: uuid
- example: 0191a23b-dead-7000-beef-000000000002
- name:
- type: string
- example: Push Day
- exercises:
- type: array
- items:
- type: object
- required:
- - id
- - name
- - exercise_type
- - position
- properties:
- id:
- type: string
- format: uuid
- example: 0191a23b-dead-7000-beef-000000000003
- name:
- type: string
- example: Bench Press
- notes:
- type: string
- nullable: true
- example: Keep elbows tucked
- exercise_type:
- $ref: '../components/schemas/ExerciseType.yaml'
- position:
- type: integer
- description: 1-based position of the exercise within its workout.
- example: 1
- example:
- id: 0191a23b-dead-7000-beef-000000000002
- name: Push Day
- exercises:
- - id: 0191a23b-dead-7000-beef-000000000003
- name: Bench Press
- notes: null
- exercise_type: WeightedReps
- position: 1
- - id: 0191a23b-dead-7000-beef-000000000004
- name: Push-ups
- notes: null
- exercise_type: BodyweightReps
- position: 2
- - id: 0191a23b-dead-7000-beef-000000000005
- name: Treadmill
- notes: null
- exercise_type: Cardio
- position: 3
- '422':
- description: Two or more exercises share the same position.
- content:
- application/json:
- schema:
- $ref: '../components/schemas/ErrorResponse.yaml'
- example:
- error: Two or more exercises share the same position. Each exercise must have a unique position within the workout.
- '401':
- description: Missing or invalid auth token.
- content:
- application/json:
- schema:
- $ref: '../components/schemas/ErrorResponse.yaml'
- examples:
- missing:
- summary: No cookie present
- value:
- error: Missing auth token
- invalid:
- summary: Token invalid or expired
- value:
- error: Invalid auth token
- '500':
- description: Internal server error.
- content:
- application/json:
- schema:
- $ref: '../components/schemas/ErrorResponse.yaml'
|