workout.yaml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. get:
  2. summary: List all workouts for the current user
  3. operationId: listWorkouts
  4. tags:
  5. - Workouts
  6. security:
  7. - cookieAuth: []
  8. responses:
  9. '200':
  10. description: Array of workouts belonging to the authenticated user.
  11. content:
  12. application/json:
  13. schema:
  14. type: array
  15. items:
  16. type: object
  17. required:
  18. - id
  19. - name
  20. properties:
  21. id:
  22. type: string
  23. format: uuid
  24. example: 0191a23b-dead-7000-beef-000000000002
  25. name:
  26. type: string
  27. example: Push Day
  28. example:
  29. - id: 0191a23b-dead-7000-beef-000000000002
  30. name: Push Day
  31. - id: 0191a23b-dead-7000-beef-000000000005
  32. name: Pull Day
  33. '401':
  34. description: Missing or invalid auth token.
  35. content:
  36. application/json:
  37. schema:
  38. $ref: '../components/schemas/ErrorResponse.yaml'
  39. examples:
  40. missing:
  41. summary: No cookie present
  42. value:
  43. error: Missing auth token
  44. invalid:
  45. summary: Token invalid or expired
  46. value:
  47. error: Invalid auth token
  48. '500':
  49. description: Internal server error.
  50. content:
  51. application/json:
  52. schema:
  53. $ref: '../components/schemas/ErrorResponse.yaml'
  54. post:
  55. summary: Create a new workout
  56. operationId: createWorkout
  57. tags:
  58. - Workouts
  59. security:
  60. - cookieAuth: []
  61. requestBody:
  62. required: true
  63. content:
  64. application/json:
  65. schema:
  66. type: object
  67. required:
  68. - name
  69. - exercises
  70. properties:
  71. name:
  72. type: string
  73. example: Push Day
  74. exercises:
  75. type: array
  76. items:
  77. type: object
  78. required:
  79. - name
  80. - exercise_type
  81. - position
  82. properties:
  83. name:
  84. type: string
  85. example: Bench Press
  86. exercise_type:
  87. $ref: '../components/schemas/ExerciseType.yaml'
  88. position:
  89. type: integer
  90. description: 1-based position of the exercise within the workout.
  91. example: 1
  92. example:
  93. name: Push Day
  94. exercises:
  95. - name: Bench Press
  96. exercise_type: WeightedReps
  97. position: 1
  98. - name: Push-ups
  99. exercise_type: BodyweightReps
  100. position: 2
  101. - name: Treadmill
  102. exercise_type: Cardio
  103. position: 3
  104. responses:
  105. '201':
  106. description: Workout created successfully. Returns the full created workout, including generated IDs for the exercises.
  107. content:
  108. application/json:
  109. schema:
  110. type: object
  111. required:
  112. - id
  113. - name
  114. - exercises
  115. properties:
  116. id:
  117. type: string
  118. format: uuid
  119. example: 0191a23b-dead-7000-beef-000000000002
  120. name:
  121. type: string
  122. example: Push Day
  123. exercises:
  124. type: array
  125. items:
  126. type: object
  127. required:
  128. - id
  129. - name
  130. - exercise_type
  131. - position
  132. properties:
  133. id:
  134. type: string
  135. format: uuid
  136. example: 0191a23b-dead-7000-beef-000000000003
  137. name:
  138. type: string
  139. example: Bench Press
  140. notes:
  141. type: string
  142. nullable: true
  143. example: Keep elbows tucked
  144. exercise_type:
  145. $ref: '../components/schemas/ExerciseType.yaml'
  146. position:
  147. type: integer
  148. description: 1-based position of the exercise within its workout.
  149. example: 1
  150. example:
  151. id: 0191a23b-dead-7000-beef-000000000002
  152. name: Push Day
  153. exercises:
  154. - id: 0191a23b-dead-7000-beef-000000000003
  155. name: Bench Press
  156. notes: null
  157. exercise_type: WeightedReps
  158. position: 1
  159. - id: 0191a23b-dead-7000-beef-000000000004
  160. name: Push-ups
  161. notes: null
  162. exercise_type: BodyweightReps
  163. position: 2
  164. - id: 0191a23b-dead-7000-beef-000000000005
  165. name: Treadmill
  166. notes: null
  167. exercise_type: Cardio
  168. position: 3
  169. '422':
  170. description: Two or more exercises share the same position.
  171. content:
  172. application/json:
  173. schema:
  174. $ref: '../components/schemas/ErrorResponse.yaml'
  175. example:
  176. error: Two or more exercises share the same position. Each exercise must have a unique position within the workout.
  177. '401':
  178. description: Missing or invalid auth token.
  179. content:
  180. application/json:
  181. schema:
  182. $ref: '../components/schemas/ErrorResponse.yaml'
  183. examples:
  184. missing:
  185. summary: No cookie present
  186. value:
  187. error: Missing auth token
  188. invalid:
  189. summary: Token invalid or expired
  190. value:
  191. error: Invalid auth token
  192. '500':
  193. description: Internal server error.
  194. content:
  195. application/json:
  196. schema:
  197. $ref: '../components/schemas/ErrorResponse.yaml'