feat: define all 8 SQLModel tables
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
37
app/models/workout_log.py
Normal file
37
app/models/workout_log.py
Normal file
@@ -0,0 +1,37 @@
|
||||
"""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)
|
||||
Reference in New Issue
Block a user