Add post endpoint for logout
This commit is contained in:
parent
b8786bdf5c
commit
ad175f15e0
19
endpoints/logout.post.py
Normal file
19
endpoints/logout.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
|
||||||
|
|
||||||
|
router = APIRouter()
|
||||||
|
|
||||||
|
@router.post("/logout", status_code=200)
|
||||||
|
async def logout(
|
||||||
|
db: Session = Depends(get_db)
|
||||||
|
):
|
||||||
|
"""Logout user"""
|
||||||
|
# Use helper function to handle logout
|
||||||
|
logout_user(db)
|
||||||
|
return {"message": "Successfully logged out"}
|
Loading…
x
Reference in New Issue
Block a user