Files
healthy-fit/backend/app/models/kettlebell.py
Carlos Escalante f279907ae3 Add supplements, kettlebell, calendar, push notifications, and PWA support
- Supplement tracking: CRUD endpoints, /today, /logs, Supplements page
- Kettlebell workouts: session tracking, analytics endpoint, ActiveSession page
- Calendar module: events CRUD, calendar components
- Push notifications: VAPID keys, PushSubscription model, APScheduler reminders,
  service worker with push/notificationclick handlers, Profile notifications UI
- PWA: vite-plugin-pwa, manifest, icons, service worker generation
- Frontend: TypeScript types, API modules, ConfirmModal, toast notifications
- Auth fixes: password hashing, nutrition endpoint auth
- CLAUDE.md: project documentation and development guide

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:57:03 -06:00

45 lines
1.5 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from datetime import datetime
from typing import Optional
from pydantic import BaseModel
from sqlmodel import JSON, Field, SQLModel
class ExerciseBlock(BaseModel):
order: int
name: str
description: str
sets: int
reps: int
duration_seconds: int # reps=0 → timed, duration_seconds=0 → rep-based
weight_kg: float
rest_seconds: int
coaching_tip: str
class KettlebellSession(SQLModel, table=True):
id: Optional[int] = Field(default=None, primary_key=True)
user_id: int = Field(foreign_key="user.id", index=True)
title: str
focus: str # e.g. "strength", "conditioning"
exercises: dict = Field(default={}, sa_type=JSON) # full AI-prescribed exercise list
total_duration_min: int
difficulty: str
notes: str = Field(default="")
status: str = Field(default="generated") # "generated" | "in_progress" | "completed" | "abandoned"
started_at: Optional[datetime] = Field(default=None)
completed_at: Optional[datetime] = Field(default=None)
created_at: datetime = Field(default_factory=datetime.utcnow)
class KettlebellSetLog(SQLModel, table=True):
id: Optional[int] = Field(default=None, primary_key=True)
session_id: int = Field(foreign_key="kettlebellsession.id", index=True)
exercise_order: int
set_number: int
actual_reps: int
actual_weight_kg: float
actual_duration_seconds: int
perceived_effort: int # 110 RPE
completed_at: datetime = Field(default_factory=datetime.utcnow)