From 28098d5be547650adfeebe1fcb0dedac76cdeb29 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Fri, 28 Mar 2025 10:44:39 +0100 Subject: [PATCH] Update code in endpoints/logout.post.py --- endpoints/logout.post.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/endpoints/logout.post.py b/endpoints/logout.post.py index 12646c8..d985242 100644 --- a/endpoints/logout.post.py +++ b/endpoints/logout.post.py @@ -1,17 +1,19 @@ # Entity: User from fastapi import APIRouter, Depends, status +from fastapi.security import OAuth2PasswordBearer from sqlalchemy.orm import Session from core.database import get_db -from models.user import User -from schemas.user import UserSchema +from schemas.user import UserToken from helpers.user_helpers import logout_user router = APIRouter() +oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token") @router.post("/logout", status_code=200) async def logout( + token: str = Depends(oauth2_scheme), db: Session = Depends(get_db) ): - logout_user(db) - return {"message": "Successfully logged out"} \ No newline at end of file + logout_user(token, db) + return {"message": "Logout successful"} \ No newline at end of file