2026-02-04 02:28:51 +05:30
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
from fastapi import APIRouter, Depends, HTTPException, status
|
|
|
|
|
|
2026-02-04 03:57:19 +05:30
|
|
|
from app.core.auth import AuthContext, get_auth_context
|
2026-02-04 02:28:51 +05:30
|
|
|
from app.schemas.users import UserRead
|
|
|
|
|
|
|
|
|
|
router = APIRouter(prefix="/auth", tags=["auth"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@router.post("/bootstrap", response_model=UserRead)
|
2026-02-04 03:57:19 +05:30
|
|
|
async def bootstrap_user(auth: AuthContext = Depends(get_auth_context)) -> UserRead:
|
2026-02-04 02:28:51 +05:30
|
|
|
if auth.actor_type != "user" or auth.user is None:
|
|
|
|
|
raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED)
|
2026-02-04 03:57:19 +05:30
|
|
|
return UserRead.model_validate(auth.user)
|