john-s3w5k1/endpoints/logout.post.py
2025-03-28 15:02:29 +00:00

18 lines
475 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
router = APIRouter()
@router.post("/logout", status_code=200)
async def logout(
db: Session = Depends(get_db)
):
"""Logout user"""
result = logout_user(db)
return {"message": "Successfully logged out"}