mirror of
https://github.com/sstent/FitTrack_GarminSync.git
synced 2026-03-17 02:15:35 +00:00
feat: Initial commit of FitTrack_GarminSync project
This commit is contained in:
53
backend/src/schemas.py
Normal file
53
backend/src/schemas.py
Normal file
@@ -0,0 +1,53 @@
|
||||
from pydantic import BaseModel, Field
|
||||
from typing import Optional, Dict, Any
|
||||
from datetime import datetime, date
|
||||
|
||||
from .jobs import SyncJob
|
||||
|
||||
class UserBase(BaseModel):
|
||||
name: str
|
||||
email: str
|
||||
|
||||
class UserCreate(UserBase):
|
||||
pass
|
||||
|
||||
class User(UserBase):
|
||||
id: int
|
||||
preferences: Optional[Dict[str, Any]] = None
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
class TokenBase(BaseModel):
|
||||
access_token: str
|
||||
refresh_token: str
|
||||
expires_at: int # Unix timestamp
|
||||
|
||||
class TokenCreate(TokenBase):
|
||||
user_id: int
|
||||
|
||||
class TokenUpdate(TokenBase):
|
||||
user_id: int
|
||||
|
||||
class Token(TokenBase):
|
||||
id: int
|
||||
user_id: int
|
||||
created_at: datetime
|
||||
updated_at: Optional[datetime] = None
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
class WorkoutPlan(BaseModel):
|
||||
id: int
|
||||
user_id: int
|
||||
plan_details: Dict[str, Any]
|
||||
created_at: datetime
|
||||
|
||||
class ActivitySyncRequest(BaseModel):
|
||||
force_resync: bool = Field(False, description="If true, re-download activities even if they exist. Defaults to false.")
|
||||
start_date: Optional[date] = Field(None, description="Optional start date (YYYY-MM-DD) to sync activities from. If not provided, syncs recent activities.")
|
||||
end_date: Optional[date] = Field(None, description="Optional end date (YYYY-MM-DD) to sync activities up to.")
|
||||
|
||||
class WorkoutUploadRequest(BaseModel):
|
||||
workout_id: int = Field(..., description="The ID of the workout to upload from CentralDB.")
|
||||
Reference in New Issue
Block a user