From 5a5476a47c0405188faa3e5137812cb87bbd947e Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Fri, 28 Mar 2025 15:20:53 +0000 Subject: [PATCH] Update code in endpoints/logouts.post.py --- endpoints/logouts.post.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 endpoints/logouts.post.py diff --git a/endpoints/logouts.post.py b/endpoints/logouts.post.py new file mode 100644 index 0000000..c55066f --- /dev/null +++ b/endpoints/logouts.post.py @@ -0,0 +1,19 @@ +# 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"} \ No newline at end of file