Update code in endpoints/logout.post.py
This commit is contained in:
parent
217364f752
commit
94c213323b
18
endpoints/logout.post.py
Normal file
18
endpoints/logout.post.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Entity: User
|
||||||
|
|
||||||
|
from fastapi import APIRouter, Depends, HTTPException, 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("/logout", 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": "Logged out successfully"}
|
Loading…
x
Reference in New Issue
Block a user