feat: pydantic models for swagger

This commit is contained in:
TheNoxium
2025-05-26 13:45:40 +05:00
parent 96dbc744d7
commit 98a4692247
8 changed files with 43 additions and 50 deletions

View File

@@ -26,7 +26,7 @@ from api.services.auth import authenticate_user
from api.db.logic.auth import add_new_refresh_token,upgrade_old_refresh_token
from api.schemas.endpoints.auth import Auth
from api.schemas.endpoints.auth import Auth, Access
api_router = APIRouter(
prefix="/auth",
@@ -52,7 +52,7 @@ def get_config():
return Settings()
@api_router.post("")
@api_router.post("", response_model=Access)
async def login_for_access_token(
user: Auth,
response: Response,
@@ -95,16 +95,11 @@ async def login_for_access_token(
Authorize.set_refresh_cookies(refresh_token)
return {
"access_token": access_token,
# "access_token_expires": access_token_expires_time,
# "refresh_token": refresh_token,
# "refresh_token_expires": refresh_token_expires_time
}
return Access(access_token=access_token)
@api_router.post("/refresh")
@api_router.post("/refresh",response_model=Access)
async def refresh(
request: Request,
connection: AsyncConnection = Depends(get_connection_dep),
@@ -138,9 +133,4 @@ async def refresh(
subject=current_user, expires_time=access_token_expires
)
return {
"access_token": new_access_token,
# "access_token_expires": access_token_expires_time,
# "refresh_token": refresh_token,
# "refresh_token_expires": refresh_token_expires_time
}
return Access(access_token=new_access_token)