Exercises Domain Schemas

Pydantic & msgspec.Struct Data Transfer Objects (DTOs) for the Exercises sub-domain.

Utility Definitions

class ExerciseScope(*values)[source]

Bases: StrEnum

Defines the visibility and ownership scope of an exercise.

Used for filtering system-provided vs user-created content.

SYSTEM = 'system'
USER = 'user'
ALL = 'all'
class DifficultyLevelType(*values)[source]

Bases: StrEnum

The perceived difficulty level of an exercise.

BEGINNER = 'beginner'
INTERMEDIATE = 'intermediate'
EXPERT = 'expert'
class ForceType(*values)[source]

Bases: StrEnum

The type of force required to perform the exercise.

PULL = 'pull'
PUSH = 'push'
STATIC = 'static'
class MechanicType(*values)[source]

Bases: StrEnum

The mechanical action of the exercise.

COMPOUND = 'compound'
ISOLATION = 'isolation'
class CategoryType(*values)[source]

Bases: StrEnum

The primary fitness category or goal of the exercise.

STRENGTH = 'strength'
STRETCHING = 'stretching'
PLYOMETRICS = 'plyometrics'
STRONGMAN = 'strongman'
POWERLIFTING = 'powerlifting'
CARDIO = 'cardio'
OLYMPIC_WEIGHTLIFTING = 'olympic weightlifting'

Base Definitions

class ExerciseBase[source]

Bases: CamelizedBaseSchema

Base exercise attributes used as a blueprint for other schemas.

field name: Annotated[str, FieldInfo(annotation=NoneType, required=False, default=None, description='Unique exercise name (3-100 characters).', metadata=[MinLen(min_length=3), MaxLen(max_length=100)])] = None

Unique exercise name (3-100 characters).

field primary_muscles: Annotated[list[int] | None, FieldInfo(annotation=NoneType, required=True, description='IDs of the **main muscle groups** targeted. Must include at least one ID.', metadata=[MinLen(min_length=1)])] = None (alias 'primaryMuscles')

IDs of the main muscle groups targeted. Must include at least one ID.

field secondary_muscles: Annotated[list[int] | None, FieldInfo(annotation=NoneType, required=True, description='IDs of the **assisting muscle groups** involved. Must include at least one ID.', metadata=[MinLen(min_length=1)])] = None (alias 'secondaryMuscles')

IDs of the assisting muscle groups involved. Must include at least one ID.

field force: ForceType | None = None
field difficulty_level: DifficultyLevelType | None = None (alias 'difficultyLevel')
field mechanic: MechanicType | None = None
field equipment: Annotated[list[int] | None, FieldInfo(annotation=NoneType, required=True, description='IDs of the **equipment** required for the exercise. Must include at least one ID.', metadata=[MinLen(min_length=1)])] = None

IDs of the equipment required for the exercise. Must include at least one ID.

field category: CategoryType | None = None
field instructions: str | None = None

User Exercise Models

class ExerciseCreate[source]

Bases: ExerciseBase

Schema for user-level exercise creation. Requires core fields.

field name: Annotated[str, FieldInfo(annotation=NoneType, required=True, description='Unique exercise name (3-100 characters).', metadata=[MinLen(min_length=3), MaxLen(max_length=100)])] [Required]

Unique exercise name (3-100 characters).

field primary_muscles: Annotated[list[int], FieldInfo(annotation=NoneType, required=True, description='IDs of the **main muscle groups** targeted. Must include at least one ID.', metadata=[MinLen(min_length=1)])] [Required] (alias 'primaryMuscles')

IDs of the main muscle groups targeted. Must include at least one ID.

field difficulty_level: DifficultyLevelType [Required] (alias 'difficultyLevel')
field category: CategoryType [Required]
field secondary_muscles: Annotated[list[int] | None, Field(min_length=1, description='IDs of the **assisting muscle groups** involved. Must include at least one ID.')] = None (alias 'secondaryMuscles')

IDs of the assisting muscle groups involved. Must include at least one ID.

field force: ForceType | None = None
field mechanic: MechanicType | None = None
field equipment: Annotated[list[int] | None, Field(min_length=1, description='IDs of the **equipment** required for the exercise. Must include at least one ID.')] = None

IDs of the equipment required for the exercise. Must include at least one ID.

field instructions: str | None = None
class ExerciseUpdate[source]

Bases: ExerciseBase

Schema for partial updates of user exercises.

field primary_muscles: Annotated[list[int], FieldInfo(annotation=NoneType, required=False, default=None, description='IDs of the **main muscle groups** targeted. Must include at least one ID.', metadata=[MinLen(min_length=1)])] = None (alias 'primaryMuscles')

IDs of the main muscle groups targeted. Must include at least one ID.

field name: Annotated[str, Field(default=None, min_length=3, max_length=100, description='Unique exercise name (3-100 characters).')] = None

Unique exercise name (3-100 characters).

field secondary_muscles: Annotated[list[int] | None, Field(min_length=1, description='IDs of the **assisting muscle groups** involved. Must include at least one ID.')] = None (alias 'secondaryMuscles')

IDs of the assisting muscle groups involved. Must include at least one ID.

field force: ForceType | None = None
field difficulty_level: DifficultyLevelType | None = None (alias 'difficultyLevel')
field mechanic: MechanicType | None = None
field equipment: Annotated[list[int] | None, Field(min_length=1, description='IDs of the **equipment** required for the exercise. Must include at least one ID.')] = None

IDs of the equipment required for the exercise. Must include at least one ID.

field category: CategoryType | None = None
field instructions: str | None = None

System Exercise Models

class ExerciseCreateSystem[source]

Bases: ExerciseCreate

Admin-level schema for system exercises with specific fields.

field image_path_start: Annotated[str, FieldInfo(annotation=NoneType, required=True, description="Path relative to the exercise folder. Must start with a slash. Used for 'start' position images. Example format: '/{exercise name}/{filename}.jpg'", examples=['/ab-roller/0.jpg', '/bench-press/images/start.webp'], metadata=[_PydanticGeneralMetadata(pattern='^/[a-z0-9\\-_]+(?:/[a-z0-9\\-_]+)*\\.(?:jpg|jpeg|png|webp)$')])] | None = None (alias 'imagePathStart')
field image_path_end: Annotated[str, FieldInfo(annotation=NoneType, required=True, description="Path relative to the exercise folder. Must start with a slash. Used for 'end' position images. Example format: '/{exercise name}/{filename}.jpg'", examples=['/ab-roller/0.jpg', '/bench-press/images/start.webp'], metadata=[_PydanticGeneralMetadata(pattern='^/[a-z0-9\\-_]+(?:/[a-z0-9\\-_]+)*\\.(?:jpg|jpeg|png|webp)$')])] | None = None (alias 'imagePathEnd')
field instructions: str [Required]
field tags: Annotated[list[int], FieldInfo(annotation=NoneType, required=True, description='System-defined tag IDs (e.g., equipment types, goals). Must include at least one ID.', metadata=[MinLen(min_length=1)])] [Required]

System-defined tag IDs (e.g., equipment types, goals). Must include at least one ID.

property slug: str

URL-friendly identifier generated from the name.

field name: Annotated[str, Field(min_length=3, max_length=100, description='Unique exercise name (3-100 characters).')] [Required]

Unique exercise name (3-100 characters).

field primary_muscles: Annotated[list[int], Field(min_length=1, description='IDs of the **main muscle groups** targeted. Must include at least one ID.')] [Required] (alias 'primaryMuscles')

IDs of the main muscle groups targeted. Must include at least one ID.

field difficulty_level: DifficultyLevelType [Required] (alias 'difficultyLevel')
field category: CategoryType [Required]
field secondary_muscles: Annotated[list[int] | None, Field(min_length=1, description='IDs of the **assisting muscle groups** involved. Must include at least one ID.')] = None (alias 'secondaryMuscles')

IDs of the assisting muscle groups involved. Must include at least one ID.

field force: ForceType | None = None
field mechanic: MechanicType | None = None
field equipment: Annotated[list[int] | None, Field(min_length=1, description='IDs of the **equipment** required for the exercise. Must include at least one ID.')] = None

IDs of the equipment required for the exercise. Must include at least one ID.

class ExerciseUpdateSystem[source]

Bases: ExerciseUpdate

Schema for administrative updates of system exercises.

field image_path_start: Annotated[str, FieldInfo(annotation=NoneType, required=True, description="Path relative to the exercise folder. Must start with a slash. Used for 'start' position images. Example format: '/{exercise name}/{filename}.jpg'", examples=['/ab-roller/0.jpg', '/bench-press/images/start.webp'], metadata=[_PydanticGeneralMetadata(pattern='^/[a-z0-9\\-_]+(?:/[a-z0-9\\-_]+)*\\.(?:jpg|jpeg|png|webp)$')])] | None = None (alias 'imagePathStart')
field image_path_end: Annotated[str, FieldInfo(annotation=NoneType, required=True, description="Path relative to the exercise folder. Must start with a slash. Used for 'end' position images. Example format: '/{exercise name}/{filename}.jpg'", examples=['/ab-roller/0.jpg', '/bench-press/images/start.webp'], metadata=[_PydanticGeneralMetadata(pattern='^/[a-z0-9\\-_]+(?:/[a-z0-9\\-_]+)*\\.(?:jpg|jpeg|png|webp)$')])] | None = None (alias 'imagePathEnd')
field tags: Annotated[list[int], FieldInfo(annotation=NoneType, required=False, default=None, description='Updated list of system tag IDs. Must include at least one ID.', metadata=[MinLen(min_length=1)])] = None

Updated list of system tag IDs. Must include at least one ID.

field slug: Annotated[str | None, SkipJsonSchema()] = None
field primary_muscles: Annotated[list[int], Field(default=None, min_length=1, description='IDs of the **main muscle groups** targeted. Must include at least one ID.')] = None (alias 'primaryMuscles')

IDs of the main muscle groups targeted. Must include at least one ID.

field name: Annotated[str, Field(default=None, min_length=3, max_length=100, description='Unique exercise name (3-100 characters).')] = None

Unique exercise name (3-100 characters).

field secondary_muscles: Annotated[list[int] | None, Field(min_length=1, description='IDs of the **assisting muscle groups** involved. Must include at least one ID.')] = None (alias 'secondaryMuscles')

IDs of the assisting muscle groups involved. Must include at least one ID.

field force: ForceType | None = None
field difficulty_level: DifficultyLevelType | None = None (alias 'difficultyLevel')
field mechanic: MechanicType | None = None
field equipment: Annotated[list[int] | None, Field(min_length=1, description='IDs of the **equipment** required for the exercise. Must include at least one ID.')] = None

IDs of the equipment required for the exercise. Must include at least one ID.

field category: CategoryType | None = None
field instructions: str | None = None

Response Models

class ExerciseRead(id: UUID, name: str, primary_muscles: list[MuscleGroupRead], secondary_muscles: list[MuscleGroupRead], force: str | None, difficulty_level: str, mechanic: str | None, equipment: list[EquipmentRead], category: str, instructions: str | None, image_path_start: str | None, image_path_end: str | None, tags: list[ExerciseTagRead], slug: str | None, created_by: UUID | None, created_at: datetime, updated_at: datetime)[source]

Bases: CamelizedBaseStruct

Complete exercise data representation for read operations.

id: UUID
name: str
primary_muscles: list[MuscleGroupRead]
secondary_muscles: list[MuscleGroupRead]
force: str | None
difficulty_level: str
mechanic: str | None
equipment: list[EquipmentRead]
category: str
instructions: str | None
image_path_start: str | None
image_path_end: str | None
tags: list[ExerciseTagRead]
slug: str | None
created_by: UUID | None
created_at: datetime
updated_at: datetime