Exercise Management Controllers

Exercise Management Endpoints.

Provides functionality for CRUD operations on exercises. Distinguishes between user-defined custom exercises and system-wide defaults.

Creating, updating, and deleting system-default exercises requires superuser privileges.

async create_exercise(user_auth: app.domain.users.schemas.UserAuth, exercise_create: ExerciseCreate) MsgSpecJSONResponse[source]

Create a new exercise for the current user.

Returns:

The created exercise data.

Return type:

ExerciseRead

Raises:

ConflictException – If an exercise with the same name already exists for the user.

async create_system_exercise(_: app.domain.users.schemas.UserAuth, exercise_create: ExerciseCreateSystem) MsgSpecJSONResponse[source]

Create a new system exercise.

Requires superuser privileges.

Returns:

The created system exercise data.

Return type:

ExerciseRead

Raises:

ConflictException – If a similar exercise already exists in the system.

async get_exercise(user_auth: app.domain.users.schemas.UserAuth, exercise_id: UUID) MsgSpecJSONResponse[source]

Get details for a specific exercise by its ID.

Users can access their own exercises, system-default exercises, or exercises shared with them if they have the ‘trainer’ role.

Returns:

Detailed exercise data.

Return type:

ExerciseRead

Raises:
async find_exercise(user_auth: app.domain.users.schemas.UserAuth = None) MsgSpecJSONResponse[source]

Find a user-defined or system exercise by name or slug.

Returns:

The found exercise data.

Return type:

ExerciseRead

Raises:

NotFoundException – If no exercise matches the criteria.

async get_list_exercises(user_auth: app.domain.users.schemas.UserAuth) MsgSpecJSONResponse[source]

Retrieve a paginated list of exercises based on filters.

Returns:

A paginated list of exercises.

Return type:

OffsetPagination[ExerciseRead]

async update_user_exercise(user_auth: app.domain.users.schemas.UserAuth, exercise_update: ExerciseUpdate, exercise_id: UUID) MsgSpecJSONResponse[source]

Update details for a specific user-defined exercise.

Returns:

The updated exercise data.

Return type:

ExerciseRead

Raises:
async update_system_exercise(_: app.domain.users.schemas.UserAuth, exercise_update: ExerciseUpdateSystem, exercise_id: UUID) MsgSpecJSONResponse[source]

Update details for a specific system exercise.

Requires superuser privileges.

Returns:

The updated system exercise data.

Return type:

ExerciseRead

Raises:
async delete_exercise(user_auth: app.domain.users.schemas.UserAuth, exercise_id: UUID) Response[source]

Delete a specific exercise by its ID.

Users can delete their own exercises. Requires superuser privileges to delete system exercises.

Returns:

204 No Content on successful deletion.

Return type:

Response

Raises: