before claude fix #1
This commit is contained in:
51
FitnessSync/backend/src/api/sync.py
Normal file
51
FitnessSync/backend/src/api/sync.py
Normal file
@@ -0,0 +1,51 @@
|
||||
from fastapi import APIRouter, Depends
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional
|
||||
from ..services.postgresql_manager import PostgreSQLManager
|
||||
from sqlalchemy.orm import Session
|
||||
from ..utils.config import config
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
class SyncActivityRequest(BaseModel):
|
||||
days_back: int = 30
|
||||
|
||||
class SyncResponse(BaseModel):
|
||||
status: str
|
||||
message: str
|
||||
job_id: Optional[str] = None
|
||||
|
||||
def get_db():
|
||||
db_manager = PostgreSQLManager(config.DATABASE_URL)
|
||||
with db_manager.get_db_session() as session:
|
||||
yield session
|
||||
|
||||
@router.post("/sync/weight", response_model=SyncResponse)
|
||||
async def sync_weight(db: Session = Depends(get_db)):
|
||||
# This would trigger the weight sync process
|
||||
# Implementation will connect with the services layer
|
||||
return {
|
||||
"status": "started",
|
||||
"message": "Weight sync process started",
|
||||
"job_id": "weight-sync-12345"
|
||||
}
|
||||
|
||||
@router.post("/sync/activities", response_model=SyncResponse)
|
||||
async def sync_activities(request: SyncActivityRequest, db: Session = Depends(get_db)):
|
||||
# This would trigger the activity sync process
|
||||
# Implementation will connect with the services layer
|
||||
return {
|
||||
"status": "started",
|
||||
"message": "Activity sync process started",
|
||||
"job_id": f"activity-sync-{request.days_back}"
|
||||
}
|
||||
|
||||
@router.post("/sync/metrics", response_model=SyncResponse)
|
||||
async def sync_metrics(db: Session = Depends(get_db)):
|
||||
# This would trigger the health metrics sync process
|
||||
# Implementation will connect with the services layer
|
||||
return {
|
||||
"status": "started",
|
||||
"message": "Health metrics sync process started",
|
||||
"job_id": "metrics-sync-12345"
|
||||
}
|
||||
Reference in New Issue
Block a user