diff options
| author | Christian Cleberg <[email protected]> | 2026-04-08 14:29:21 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-04-08 14:29:21 -0500 |
| commit | a7c25076d16bde9ec928b9ef01bce952406ea7b1 (patch) | |
| tree | 802c5f84902f240c6aab95acc1e6348dfbd806c2 /app/routers/devices.py | |
| download | hutch-notify-a7c25076d16bde9ec928b9ef01bce952406ea7b1.tar.gz hutch-notify-a7c25076d16bde9ec928b9ef01bce952406ea7b1.tar.bz2 hutch-notify-a7c25076d16bde9ec928b9ef01bce952406ea7b1.zip | |
initial commit
Diffstat (limited to 'app/routers/devices.py')
| -rw-r--r-- | app/routers/devices.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/app/routers/devices.py b/app/routers/devices.py new file mode 100644 index 0000000..882c474 --- /dev/null +++ b/app/routers/devices.py @@ -0,0 +1,20 @@ +from fastapi import APIRouter, Depends +from sqlalchemy.ext.asyncio import AsyncSession +from app.db import get_db +from app.schemas import DeviceRegisterIn +from app.crud import upsert_device +from app.security import require_api_key + +router = APIRouter(prefix="/v1/devices", tags=["devices"], dependencies=[Depends(require_api_key)]) + + [email protected]("/register") +async def register_device(payload: DeviceRegisterIn, db: AsyncSession = Depends(get_db)) -> dict: + device = await upsert_device(db, payload) + return { + "id": device.id, + "user_id": device.user_id, + "bundle_id": device.bundle_id, + "apns_env": device.apns_env, + "is_enabled": device.is_enabled, + } |
