Modules:
| Module | Controller | Service(s) | Repository/ ORM |
|---|---|---|---|
| exercise.module | exercise.Controller | exercise.service | Exercise |
| exercise-request.module | exercise-request.Controller | exercise-request.service | ExerciseRequest |
| user-exercise.module | user-exercise.Controller | user-exercise.service | UserExercise |
| workout.module | workout.Controller | workout.service | Workout |
| user.module | user.Controller | user.service | User |
Routes:
Project_Workout example 1.0
The Project_Workout API description
App
GET /
Responses
Users
POST /users/sign-in
Sign into a route
Request body
{
"username": "John",
"password": "Very12Secure&^Password^"
}
Schema of the request body
{
"type": "object",
"properties": {
"username": {
"type": "string",
"example": "John"
},
"password": {
"type": "string",
"example": "Very12Secure&^Password^"
}
},
"required": [
"username",
"password"
]
}
Responses
GET /users/refresh-login
Sign up / creates an account
Responses
GET /users/my-info
Creates a request
Responses
GET /users
Gets all the users
Responses
POST /users/sign-up
Sign-up / creates an account
Request body
{
"username": "John",
"email": "john@workout.com",
"password": "Very12Secure&^Password^"
}
Schema of the request body
{
"type": "object",
"properties": {
"username": {
"type": "string",
"example": "John"
},
"email": {
"type": "string",
"example": "john@workout.com"
},
"password": {
"type": "string",
"example": "Very12Secure&^Password^"
}
},
"required": [
"username",
"email",
"password"
]
}
Responses
GET /users/{id}
Gets the user with the specified id
Input parameters
| Parameter | In | Type | Default | Nullable | Description |
|---|---|---|---|---|---|
id |
path | number | No |
Responses
PATCH /users/{id}
Updates the user
Input parameters
| Parameter | In | Type | Default | Nullable | Description |
|---|---|---|---|---|---|
id |
path | string | No |
Request body
[
{
"username": "John",
"email": "john@workout.com",
"password": "Very12Secure&^Password^",
"userType": 1
}
]
Schema of the request body
{
"type": "array",
"items": {
"$ref": "#/components/schemas/UpdateUserDto"
}
}
Responses
DELETE /users/{id}
Removes an user
Input parameters
| Parameter | In | Type | Default | Nullable | Description |
|---|---|---|---|---|---|
id |
path | string | No |
Responses
Exercises
POST /exercises/create-exercise
Creates an exercise in the public database
Request body
{
"name": "string",
"force": "static",
"level": "beginner",
"mechanic": "isolation",
"equipment": null,
"primaryMuscles": "abdominals",
"secondaryMuscles": "abdominals",
"instructions": [
"string"
],
"category": "powerlifting"
}
Schema of the request body
{
"type": "object",
"properties": {
"name": {
"type": "string"
},
"force": {
"type": "string",
"examples": [
"static",
"pull",
"push"
]
},
"level": {
"type": "string",
"examples": [
"beginner",
"intermediate",
"expert"
]
},
"mechanic": {
"type": "string",
"examples": [
"isolation",
"compound",
null
]
},
"equipment": {
"type": "string",
"examples": [
null,
"medicine ball",
"dumbbell",
"body only",
"bands",
"kettlebells",
"foam roll",
"cable",
"machine",
"barbell",
"exercise ball",
"e-z curl bar",
"other"
]
},
"primaryMuscles": {
"examples": [
"abdominals",
"abductors",
"adductors",
"biceps",
"calves",
"chest",
"forearms",
"glutes",
"hamstrings",
"lats",
"lower back",
"middle back",
"neck",
"quadriceps",
"shoulders",
"traps",
"triceps"
],
"type": "array",
"items": {
"type": "string"
}
},
"secondaryMuscles": {
"examples": [
"abdominals",
"abductors",
"adductors",
"biceps",
"calves",
"chest",
"forearms",
"glutes",
"hamstrings",
"lats",
"lower back",
"middle back",
"neck",
"quadriceps",
"shoulders",
"traps",
"triceps"
],
"type": "array",
"items": {
"type": "string"
}
},
"instructions": {
"type": "array",
"items": {
"type": "string"
}
},
"category": {
"type": "string",
"examples": [
"powerlifting",
"strength",
"stretching",
"cardio",
"olympic weightlifting",
"strongman",
"plyometrics"
]
}
},
"required": [
"name",
"force",
"level",
"mechanic",
"equipment",
"primaryMuscles",
"secondaryMuscles",
"instructions",
"category"
]
}
Responses
GET /exercises
Gets all exercises, filtering by name and muscles groups
Input parameters
| Parameter | In | Type | Default | Nullable | Description |
|---|---|---|---|---|---|
muscle_group |
query | string | No | ||
name |
query | string | No | ||
secondary_muscle_group |
query | string | No |
Responses
GET /exercises/{id}
Gets an exercise by id
Input parameters
| Parameter | In | Type | Default | Nullable | Description |
|---|---|---|---|---|---|
id |
path | string | No |
Responses
PATCH /exercises/update-exercise/{id}
Updates a exercise in the public database
Input parameters
| Parameter | In | Type | Default | Nullable | Description |
|---|---|---|---|---|---|
id |
path | string | No |
Request body
[
{
"name": "string",
"force": "static",
"level": "beginner",
"mechanic": "isolation",
"equipment": null,
"primaryMuscles": "abdominals",
"secondaryMuscles": "abdominals",
"instructions": [
"string"
],
"category": "powerlifting"
}
]
Schema of the request body
{
"type": "array",
"items": {
"$ref": "#/components/schemas/UpdateExerciseDto"
}
}
Responses
DELETE /exercises/delete-exercise/{id}
Deletes a exercise in the public database
Input parameters
| Parameter | In | Type | Default | Nullable | Description |
|---|---|---|---|---|---|
id |
path | string | No |
Responses
ExercisesRequest
POST /exercises-request/create-exercise
Creates an exercise request for the public database
Request body
{
"name": "string",
"force": "static",
"level": "beginner",
"mechanic": "isolation",
"equipment": null,
"primaryMuscles": "abdominals",
"secondaryMuscles": "abdominals",
"instructions": [
"string"
],
"category": "powerlifting"
}
Schema of the request body
{
"type": "object",
"properties": {
"name": {
"type": "string"
},
"force": {
"type": "string",
"examples": [
"static",
"pull",
"push"
]
},
"level": {
"type": "string",
"examples": [
"beginner",
"intermediate",
"expert"
]
},
"mechanic": {
"type": "string",
"examples": [
"isolation",
"compound",
null
]
},
"equipment": {
"type": "string",
"examples": [
null,
"medicine ball",
"dumbbell",
"body only",
"bands",
"kettlebells",
"foam roll",
"cable",
"machine",
"barbell",
"exercise ball",
"e-z curl bar",
"other"
]
},
"primaryMuscles": {
"examples": [
"abdominals",
"abductors",
"adductors",
"biceps",
"calves",
"chest",
"forearms",
"glutes",
"hamstrings",
"lats",
"lower back",
"middle back",
"neck",
"quadriceps",
"shoulders",
"traps",
"triceps"
],
"type": "array",
"items": {
"type": "string"
}
},
"secondaryMuscles": {
"examples": [
"abdominals",
"abductors",
"adductors",
"biceps",
"calves",
"chest",
"forearms",
"glutes",
"hamstrings",
"lats",
"lower back",
"middle back",
"neck",
"quadriceps",
"shoulders",
"traps",
"triceps"
],
"type": "array",
"items": {
"type": "string"
}
},
"instructions": {
"type": "array",
"items": {
"type": "string"
}
},
"category": {
"type": "string",
"examples": [
"powerlifting",
"strength",
"stretching",
"cardio",
"olympic weightlifting",
"strongman",
"plyometrics"
]
}
},
"required": [
"name",
"force",
"level",
"mechanic",
"equipment",
"primaryMuscles",
"secondaryMuscles",
"instructions",
"category"
]
}
Responses
GET /exercises-request
Gets all exercise request, filtering by name and muscles groups
Input parameters
| Parameter | In | Type | Default | Nullable | Description |
|---|---|---|---|---|---|
muscle_group |
query | string | No | ||
name |
query | string | No | ||
secondary_muscle_group |
query | string | No |
Responses
GET /exercises-request/{id}
Gets an exercise request by id
Input parameters
| Parameter | In | Type | Default | Nullable | Description |
|---|---|---|---|---|---|
id |
path | string | No |
Responses
PATCH /exercises-request/update-exercise/{id}
Updates an exercise request
Input parameters
| Parameter | In | Type | Default | Nullable | Description |
|---|---|---|---|---|---|
id |
path | string | No |
Request body
[
{
"name": "string",
"force": "static",
"level": "beginner",
"mechanic": "isolation",
"equipment": null,
"primaryMuscles": "abdominals",
"secondaryMuscles": "abdominals",
"instructions": [
"string"
],
"category": "powerlifting"
}
]
Schema of the request body
{
"type": "array",
"items": {
"$ref": "#/components/schemas/UpdateExerciseDto"
}
}
Responses
DELETE /exercises-request/delete-exercise/{id}
Deletes an exercise request
Input parameters
| Parameter | In | Type | Default | Nullable | Description |
|---|---|---|---|---|---|
id |
path | string | No |
Responses
UserExercises
POST /user-exercises/create-user-exercise
Create a UserExercise on a user
Request body
{
"name": "my-squat-for-strength-training",
"weight": 10.12,
"repetition": 10.12,
"restTime": 10.12,
"sets": 10.12,
"executionTime": 10.12,
"exerciseId": 10.12
}
Schema of the request body
{
"type": "object",
"properties": {
"name": {
"type": "string",
"example": "my-squat-for-strength-training"
},
"weight": {
"type": "number",
"description": "The weight of the dumbell/olympic bar/other in the exercise "
},
"repetition": {
"type": "number",
"description": "The number of repetitions between sets"
},
"restTime": {
"type": "number",
"description": "The rest time between sets"
},
"sets": {
"type": "number",
"description": "The number of times do to the exercise"
},
"executionTime": {
"type": "number",
"description": "The time of in which the user 'executes' the exercise, 0 if it's an exercise which doesn't need a timed execution"
},
"exerciseId": {
"type": "number",
"description": "The exercise in which this UserExercise refers to"
}
},
"required": [
"name",
"weight",
"repetition",
"restTime",
"sets",
"executionTime",
"exerciseId"
]
}
Responses
GET /user-exercises
Gets all the UserExercise, Only used by admins
Input parameters
| Parameter | In | Type | Default | Nullable | Description |
|---|---|---|---|---|---|
name |
query | string | No |
Responses
GET /user-exercises/my-exercises
Gets all UserExercise of a user, filtering by name if possible
Input parameters
| Parameter | In | Type | Default | Nullable | Description |
|---|---|---|---|---|---|
name |
query | string | No |
Responses
GET /user-exercises/{id}
Gets an user's UserExercise by id
Responses
PATCH /user-exercises/update-user-exercise/{id}
Updates a user's UserExercise
Request body
[
{
"name": "my-squat-for-strength-training",
"weight": 10.12,
"repetition": 10.12,
"restTime": 10.12,
"sets": 10.12,
"executionTime": 10.12,
"exerciseId": 10.12
}
]
Schema of the request body
{
"type": "array",
"items": {
"$ref": "#/components/schemas/UpdateUserExerciseDto"
}
}
Responses
DELETE /user-exercises/delete-user-exercise/{id}
Deletes a user's UserExercise
Responses
Workout
POST /workout/create-workout
Creates a new workout to user's account
Request body
{
"workoutName": "Leg day",
"weekDate": "2022-04-13T15:42:05.901Z",
"alertDate": "2022-04-13T15:42:05.901Z",
"userExercisesId": [
"string"
]
}
Schema of the request body
{
"type": "object",
"properties": {
"workoutName": {
"type": "string",
"example": "Leg day"
},
"weekDate": {
"format": "date-time",
"type": "string",
"description": "Day / of the workout"
},
"alertDate": {
"format": "date-time",
"type": "string",
"description": "Time to alert for the next workout"
},
"userExercisesId": {
"description": "user Exercises to add to the workout",
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"workoutName",
"weekDate",
"alertDate",
"userExercisesId"
]
}
Responses
GET /workout
Gets all the workout, only used by admin
Responses
GET /workout/my-workouts
Get the user's workouts, filtering by name
Input parameters
| Parameter | In | Type | Default | Nullable | Description |
|---|---|---|---|---|---|
name |
query | string | No |
Responses
GET /workout/{id}
Get the workout by id, only used by admin
Input parameters
| Parameter | In | Type | Default | Nullable | Description |
|---|---|---|---|---|---|
id |
path | string | No |
Responses
PATCH /workout/update-workout/{id}
Updates a workout with the corresponding id from the user's account
Request body
[
{
"workoutName": "Leg day",
"weekDate": "2022-04-13T15:42:05.901Z",
"alertDate": "2022-04-13T15:42:05.901Z",
"userExercisesId": [
"string"
]
}
]
Schema of the request body
{
"type": "array",
"items": {
"$ref": "#/components/schemas/UpdateWorkoutDto"
}
}
Responses
DELETE /workout/delete-workout/{id}
Deletes a workout with the corresponding id from the user's account
Input parameters
| Parameter | In | Type | Default | Nullable | Description |
|---|---|---|---|---|---|
id |
path | string | No |
Responses
Schemas
CreateExerciseDto
| Name | Type | Description |
|---|---|---|
category |
string | |
equipment |
string | |
force |
string | |
instructions |
Array<string> | |
level |
string | |
mechanic |
string | |
name |
string | |
primaryMuscles |
Array<string> | |
secondaryMuscles |
Array<string> |
CreateUserDto
| Name | Type | Description |
|---|---|---|
email |
string | |
password |
string | |
username |
string |
CreateUserExerciseDto
| Name | Type | Description |
|---|---|---|
executionTime |
number | The time of in which the user 'executes' the exercise, 0 if it's an exercise which doesn't need a timed execution |
exerciseId |
number | The exercise in which this UserExercise refers to |
name |
string | |
repetition |
number | The number of repetitions between sets |
restTime |
number | The rest time between sets |
sets |
number | The number of times do to the exercise |
weight |
number | The weight of the dumbell/olympic bar/other in the exercise |
CreateWorkoutDto
| Name | Type | Description |
|---|---|---|
alertDate |
string(date-time) | Time to alert for the next workout |
userExercisesId |
Array<string> | user Exercises to add to the workout |
weekDate |
string(date-time) | Day / of the workout |
workoutName |
string |
SignInUserDTO
| Name | Type | Description |
|---|---|---|
password |
string | |
username |
string |
UpdateExerciseDto
| Name | Type | Description |
|---|---|---|
category |
string | |
equipment |
string | |
force |
string | |
instructions |
Array<string> | |
level |
string | |
mechanic |
string | |
name |
string | |
primaryMuscles |
Array<string> | |
secondaryMuscles |
Array<string> |
UpdateUserDto
| Name | Type | Description |
|---|---|---|
email |
string | |
password |
string | |
username |
string | |
userType |
number |
UpdateUserExerciseDto
| Name | Type | Description |
|---|---|---|
executionTime |
number | The time of in which the user 'executes' the exercise, 0 if it's an exercise which doesn't need a timed execution |
exerciseId |
number | The exercise in which this UserExercise refers to |
name |
string | |
repetition |
number | The number of repetitions between sets |
restTime |
number | The rest time between sets |
sets |
number | The number of times do to the exercise |
weight |
number | The weight of the dumbell/olympic bar/other in the exercise |
UpdateWorkoutDto
| Name | Type | Description |
|---|---|---|
alertDate |
string(date-time) | Time to alert for the next workout |
userExercisesId |
Array<string> | user Exercises to add to the workout |
weekDate |
string(date-time) | Day / of the workout |
workoutName |
string |
Security schemes
| Name | Type | Scheme | Description |
|---|---|---|---|
| bearer | http | bearer |