add async with all functions

This commit is contained in:
2026-10-23 00:20:58 +03:00
parent a85702a30e
commit 7b7ca1b888
42 changed files with 901 additions and 763 deletions
+7 -7
View File
@@ -1,5 +1,5 @@
from fastapi import APIRouter, Depends, Response
from sqlalchemy.orm import Session
from sqlalchemy.ext.asyncio import AsyncSession
from app.core.config import Settings
from app.domain.auth import create_session, revoke_session
@@ -15,19 +15,19 @@ router = APIRouter(prefix="/api/v1/auth", tags=["auth"])
@router.post("/sessions", status_code=201)
def login(
async def login(
credentials: tuple[str, str] = Depends(get_basic_credentials),
session: Session = Depends(get_db),
session: AsyncSession = Depends(get_db),
settings: Settings = Depends(get_settings),
) -> AuthSession:
username, password = credentials
return create_session(session, username, password, settings.session_ttl_seconds)
return await create_session(session, username, password, settings.session_ttl_seconds)
@router.delete("/sessions/current", status_code=204)
def logout(
async def logout(
token: str = Depends(get_bearer_token),
session: Session = Depends(get_db),
session: AsyncSession = Depends(get_db),
) -> Response:
revoke_session(session, token)
await revoke_session(session, token)
return Response(status_code=204)