19 lines
554 B
Python
19 lines
554 B
Python
# Entity: Auth
|
|
|
|
from fastapi import APIRouter, Depends, HTTPException, status
|
|
from sqlalchemy.orm import Session
|
|
from core.database import get_db
|
|
from models.auth import Auth
|
|
from schemas.auth import AuthSchema
|
|
from helpers.auth_helpers import logout_user
|
|
from core.security import get_current_user
|
|
|
|
router = APIRouter()
|
|
|
|
@router.post("/logouts", status_code=200)
|
|
async def logout(
|
|
current_user: Auth = Depends(get_current_user),
|
|
db: Session = Depends(get_db)
|
|
):
|
|
logout_user(db, current_user)
|
|
return {"message": "Successfully logged out"} |