mirror of
https://github.com/escalante29/healthy-fit.git
synced 2026-03-21 12:28:46 +01:00
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>
This commit is contained in:
44
backend/app/models/kettlebell.py
Normal file
44
backend/app/models/kettlebell.py
Normal file
@@ -0,0 +1,44 @@
|
||||
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 # 1–10 RPE
|
||||
completed_at: datetime = Field(default_factory=datetime.utcnow)
|
||||
Reference in New Issue
Block a user