From 4d8d40bb43753f838708f73ad9411c2a84b96a4c Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Fri, 28 Mar 2025 11:38:06 +0100 Subject: [PATCH] Update code in endpoints/logouts.post.py --- endpoints/logouts.post.py | 18 ++++++++++++++++++ 1 file changed, 18 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..de6482b --- /dev/null +++ b/endpoints/logouts.post.py @@ -0,0 +1,18 @@ +# Entity: User + +from fastapi import APIRouter, Depends, status +from sqlalchemy.orm import Session +from core.database import get_db +from models.user import User +from schemas.user import UserSchema +from helpers.user_helpers import logout_user + +router = APIRouter() + +@router.post("/logouts", status_code=200) +async def logout( + db: Session = Depends(get_db), + current_user: User = Depends(get_current_user) +): + logout_user(db, current_user) + return {"message": "Logout successful"} \ No newline at end of file