koerner-tm34co/endpoints/logout.get.py
2025-03-28 14:42:59 +00:00

20 lines
527 B
Python

# Entity: Auth
```python
from fastapi import APIRouter, Depends, Response
from core.database import get_db
from sqlalchemy.orm import Session
from helpers.auth_helpers import logout_user
from schemas.auth import LogoutResponse
router = APIRouter()
@router.get("/logout", status_code=200, response_model=LogoutResponse)
async def logout(
response: Response,
db: Session = Depends(get_db)
):
"""Logout user by clearing auth cookies"""
logout_user(response)
return {"message": "Successfully logged out"}
```