38 lines
1.3 KiB
Python
38 lines
1.3 KiB
Python
"""WorkoutLog model for per-exercise set logging.
|
|
|
|
Each log entry records one set of one exercise within a session.
|
|
"""
|
|
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
from sqlmodel import Field, SQLModel
|
|
|
|
|
|
class WorkoutLog(SQLModel, table=True):
|
|
"""A single set log for an exercise within a workout session.
|
|
|
|
Attributes:
|
|
id: Primary key, auto-incremented.
|
|
session_id: FK to workout_sessions table.
|
|
exercise_id: FK to exercises table.
|
|
set_number: Which set this is (1, 2, 3...).
|
|
reps_completed: Actual reps performed.
|
|
weight_used: Weight used as string (e.g., "30 lbs", "BW").
|
|
felt_easy: Whether the user felt the set was easy (progression signal).
|
|
notes: Optional notes about this specific set.
|
|
created_at: Timestamp when the record was created.
|
|
"""
|
|
|
|
__tablename__ = "workout_logs"
|
|
|
|
id: Optional[int] = Field(default=None, primary_key=True)
|
|
session_id: int = Field(foreign_key="workout_sessions.id", index=True)
|
|
exercise_id: int = Field(foreign_key="exercises.id")
|
|
set_number: int = Field(default=1)
|
|
reps_completed: int = Field(default=0)
|
|
weight_used: str = Field(default="")
|
|
felt_easy: bool = Field(default=False)
|
|
notes: Optional[str] = Field(default=None)
|
|
created_at: datetime = Field(default_factory=datetime.utcnow)
|