Exercises Domain Services¶
Domain services encapsulating the business logic for exercise models, including complex relationship management and custom filtering.
—
Exercise Service (ExerciseService)¶
- class ExerciseService[source]¶
Bases:
CompositeServiceMixin,SQLAlchemyAsyncRepositoryService[Exercise, Any]Service for managing Exercise entities.
Provides high-level business logic for exercises, including handling complex relationships with muscle groups, equipment, and tags via CompositeServiceMixin.
- async get_exercise_by_filter(user_id: UUID, name: str | None, slug: str | None) ExerciseRead[source]¶
Fetch a specific exercise by name (for custom) or slug (for system).
- async update_exercise(exercise_id: UUID, data: dict[str, Any], extra_filters: dict[str, Any]) m.Exercise[source]¶
Update an exercise with optimized relationship loading.
- async delete_exercise(exercise_id: UUID, user_auth: UserAuth) None[source]¶
Delete an exercise after checking ownership or superuser status.
Deleting system-default exercises requires superuser privileges.
- async get_exercises_paginated_dto(params: ExerciseFilters, user_id: UUID) OffsetPagination[ExerciseRead][source]¶
Provide filtered and paginated list of exercises with caching.