service_man/api/router/user.py

21 lines
438 B
Python
Raw Normal View History

2024-03-04 07:12:29 +03:00
from dependency_injector.wiring import Provide, inject
2024-03-04 13:15:28 +03:00
from fastapi import APIRouter, Depends
2024-03-04 07:12:29 +03:00
2024-03-04 13:15:28 +03:00
from api.di import Container
from api.service.user import UserService
2024-03-04 07:12:29 +03:00
router = APIRouter()
@router.get("/users")
@inject
2024-03-04 13:15:28 +03:00
async def get_user_list(
2024-03-04 07:12:29 +03:00
user_service: UserService = Depends(Provide[Container.user_service]),
):
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"}