Initial commit: VoIdeaAI - voice-first AI idea assistant
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
"""Sync API routes for VoIdea."""
|
||||
|
||||
from typing import Annotated
|
||||
|
||||
from fastapi import APIRouter, Depends
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from app.core.dependencies import get_current_user, get_db
|
||||
from app.models.user import User
|
||||
from app.schemas.sync import SyncPullRequest, SyncPushRequest, SyncResponse
|
||||
from app.services.sync_service import SyncService
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.post("/pull", response_model=SyncResponse)
|
||||
async def pull(
|
||||
body: SyncPullRequest,
|
||||
user: Annotated[User, Depends(get_current_user)],
|
||||
db: AsyncSession = Depends(get_db),
|
||||
):
|
||||
service = SyncService(db)
|
||||
return await service.pull(user, last_sync=body.last_sync)
|
||||
|
||||
|
||||
@router.post("/push", response_model=SyncResponse)
|
||||
async def push(
|
||||
body: SyncPushRequest,
|
||||
user: Annotated[User, Depends(get_current_user)],
|
||||
db: AsyncSession = Depends(get_db),
|
||||
):
|
||||
service = SyncService(db)
|
||||
return await service.push(user, device_id=body.device_id, changes=body.changes)
|
||||
Reference in New Issue
Block a user