mirror of
https://github.com/escalante29/healthy-fit.git
synced 2026-03-21 10:48:46 +01:00
- 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>
28 lines
1.0 KiB
Python
28 lines
1.0 KiB
Python
from datetime import datetime
|
|
from typing import List, Optional
|
|
|
|
from sqlalchemy import Column
|
|
from sqlmodel import JSON, Field, SQLModel
|
|
|
|
|
|
class Supplement(SQLModel, table=True):
|
|
id: Optional[int] = Field(default=None, primary_key=True)
|
|
user_id: int = Field(foreign_key="user.id", index=True)
|
|
name: str = Field(index=True)
|
|
dosage: float
|
|
unit: str # mg / mcg / IU / g
|
|
frequency: str = Field(default="daily") # daily / weekly / as_needed
|
|
scheduled_times: List[str] = Field(default=[], sa_column=Column(JSON)) # ["08:00", "20:00"]
|
|
notes: Optional[str] = None
|
|
is_active: bool = Field(default=True)
|
|
created_at: datetime = Field(default_factory=datetime.utcnow)
|
|
|
|
|
|
class SupplementLog(SQLModel, table=True):
|
|
id: Optional[int] = Field(default=None, primary_key=True)
|
|
user_id: int = Field(foreign_key="user.id", index=True)
|
|
supplement_id: int = Field(foreign_key="supplement.id", index=True)
|
|
taken_at: datetime = Field(default_factory=datetime.utcnow)
|
|
dose_taken: Optional[float] = None
|
|
notes: Optional[str] = None
|