service_man/api/routers/user.py

20 lines
454 B
Python
Raw Normal View History

2024-03-04 13:15:28 +03:00
from fastapi import APIRouter, Depends
2024-03-04 07:12:29 +03:00
2024-03-11 07:48:04 +03:00
from api.di import get_user_service
2024-03-11 21:07:01 +03:00
from api.schemas import UserReadDTO
from api.services import UserService
2024-03-04 07:12:29 +03:00
router = APIRouter()
2024-03-11 21:07:01 +03:00
@router.get("/users", response_model=list[UserReadDTO])
2024-03-04 13:15:28 +03:00
async def get_user_list(
2024-03-11 07:48:04 +03:00
user_service: UserService = Depends(get_user_service),
2024-03-11 21:07:01 +03:00
) -> list[UserReadDTO]:
2024-03-04 13:15:28 +03:00
return await user_service.get_all_users()
2024-03-04 07:12:29 +03:00
@router.get("/status")
def get_status():
return {"status": "OK"}