Spaces:
Sleeping
Sleeping
Download app/api/v1/users.py from Sherry245/rideshare-api: direct link, hf CLI and curl.
- Browser
- Download file 515 Bytes
-
https://huggingface.co/spaces/Sherry245/rideshare-api/resolve/main/app/api/v1/users.py
- Command line
-
hf download hf://spaces/Sherry245/rideshare-api/app/api/v1/users.py
-
curl -L -o users.py https://huggingface.co/spaces/Sherry245/rideshare-api/resolve/main/app/api/v1/users.py
515 Bytes
| from fastapi import APIRouter, Depends | |
| from sqlalchemy.ext.asyncio import AsyncSession | |
| from app.core.database import get_db | |
| from app.deps import get_current_user | |
| from app.models.profile import Profile | |
| from app.schemas.users import PushTokenIn | |
| router = APIRouter() | |
| async def save_push_token( | |
| data: PushTokenIn, | |
| user: Profile = Depends(get_current_user), | |
| db: AsyncSession = Depends(get_db), | |
| ): | |
| user.push_token = data.token | |
| await db.commit() | |
| return {'ok': True} | |