-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It will be used to get more information about the current user
- Loading branch information
Showing
2 changed files
with
21 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from fastapi import APIRouter, Depends | ||
from sqlalchemy.orm import Session | ||
|
||
from db.db_connection import get_db | ||
from auth.auth_bearer import BearerToken | ||
from dependencies import get_current_user | ||
from schemas.user import AppUser | ||
|
||
router = APIRouter( | ||
prefix="/users", | ||
tags=["users"], | ||
responses={403: {"description": "Forbidden"}, 404: {"description": "Not found"}}, | ||
dependencies=[Depends(BearerToken())], | ||
) | ||
|
||
|
||
@router.get("/users/me", response_model=AppUser) | ||
async def get_current_user_profile(current_user=Depends(get_current_user), db: Session = Depends(get_db)): | ||
return current_user |