# Entity: User ```python from fastapi import APIRouter, Depends, HTTPException, status from fastapi.security import OAuth2PasswordBearer from core.database import get_db from sqlalchemy.orm import Session from models.user import User from schemas.user import UserSchema from core.security import get_current_user router = APIRouter() oauth2_scheme = OAuth2PasswordBearer(tokenUrl="login") @router.post("/logouts", status_code=200) async def logout( current_user: User = Depends(get_current_user), db: Session = Depends(get_db) ): try: # Clear any active sessions or tokens for the user current_user.is_active = False db.commit() return {"message": "Successfully logged out"} except Exception as e: raise HTTPException( status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail="Error during logout process" ) ```