2023-10-12 00:14:50 +02:00
|
|
|
from fastapi import APIRouter, Depends
|
2023-10-12 00:04:18 +02:00
|
|
|
from ..models import users
|
2023-10-12 00:14:50 +02:00
|
|
|
from ..dependencies import get_current_active_user
|
|
|
|
from typing import Annotated
|
2023-10-10 22:13:47 +02:00
|
|
|
|
2023-10-11 23:45:12 +02:00
|
|
|
|
2023-10-10 22:13:47 +02:00
|
|
|
router = APIRouter()
|
|
|
|
|
|
|
|
@router.get("/users/", tags=["users"])
|
|
|
|
async def read_users():
|
2023-10-12 00:14:50 +02:00
|
|
|
return [{"username":"toto"}]
|
|
|
|
|
|
|
|
@router.get("/users/me", response_model=users.User)
|
|
|
|
async def read_users_me(current_user: Annotated[users.User, Depends(get_current_active_user)]):
|
2023-10-12 23:15:26 +02:00
|
|
|
return current_user
|