Update code in endpoints/logouts.post.py
This commit is contained in:
parent
dd2b29653d
commit
5a5476a47c
19
endpoints/logouts.post.py
Normal file
19
endpoints/logouts.post.py
Normal file
@ -0,0 +1,19 @@
|
||||
# Entity: Auth
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, status
|
||||
from sqlalchemy.orm import Session
|
||||
from core.database import get_db
|
||||
from models.auth import Auth
|
||||
from schemas.auth import AuthSchema
|
||||
from helpers.auth_helpers import logout_user
|
||||
from core.security import get_current_user
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@router.post("/logouts", status_code=200)
|
||||
async def logout(
|
||||
current_user: Auth = Depends(get_current_user),
|
||||
db: Session = Depends(get_db)
|
||||
):
|
||||
logout_user(db, current_user)
|
||||
return {"message": "Successfully logged out"}
|
Loading…
x
Reference in New Issue
Block a user