workout.yaml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. post:
  2. summary: Create a new workout
  3. operationId: createWorkout
  4. tags:
  5. - Workouts
  6. security:
  7. - cookieAuth: []
  8. requestBody:
  9. required: true
  10. content:
  11. application/json:
  12. schema:
  13. type: object
  14. required:
  15. - name
  16. - exercises
  17. properties:
  18. name:
  19. type: string
  20. example: Push Day
  21. exercises:
  22. type: array
  23. items:
  24. type: object
  25. required:
  26. - name
  27. - exercise_type
  28. properties:
  29. name:
  30. type: string
  31. example: Bench Press
  32. exercise_type:
  33. $ref: '../components/schemas/ExerciseType.yaml'
  34. example:
  35. name: Push Day
  36. exercises:
  37. - name: Bench Press
  38. exercise_type: WeightedReps
  39. - name: Push-ups
  40. exercise_type: BodyweightReps
  41. - name: Treadmill
  42. exercise_type: Cardio
  43. responses:
  44. '201':
  45. description: Workout created. Returns the generated workout ID.
  46. content:
  47. application/json:
  48. schema:
  49. type: object
  50. required:
  51. - id
  52. properties:
  53. id:
  54. type: string
  55. format: uuid
  56. example: 0191a23b-dead-7000-beef-000000000002
  57. '401':
  58. description: Missing or invalid auth token.
  59. content:
  60. application/json:
  61. schema:
  62. $ref: '../components/schemas/ErrorResponse.yaml'
  63. examples:
  64. missing:
  65. summary: No cookie present
  66. value:
  67. error: Missing auth token
  68. invalid:
  69. summary: Token invalid or expired
  70. value:
  71. error: Invalid auth token
  72. '500':
  73. description: Internal server error.
  74. content:
  75. application/json:
  76. schema:
  77. $ref: '../components/schemas/ErrorResponse.yaml'