From 1667d3e2bfff221d845bfaf07b1ecc6d27912765 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Fri, 28 Mar 2025 00:34:36 +0000 Subject: [PATCH] Update code in endpoints/logout.post.py --- endpoints/logout.post.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 endpoints/logout.post.py diff --git a/endpoints/logout.post.py b/endpoints/logout.post.py new file mode 100644 index 0000000..2713ed8 --- /dev/null +++ b/endpoints/logout.post.py @@ -0,0 +1,17 @@ +# Entity: Auth + +from fastapi import APIRouter, Depends, HTTPException, status +from fastapi.security import OAuth2PasswordBearer +from sqlalchemy.orm import Session +from core.database import get_db +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""" + logout_user(db) + return {"message": "Successfully logged out"} \ No newline at end of file