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
|
2024-03-06 03:59:16 +03:00
|
|
|
from api.schemas.user_schema import UserSchema
|
2024-03-04 13:15:28 +03:00
|
|
|
from api.service.user import UserService
|
2024-03-04 07:12:29 +03:00
|
|
|
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
|
|
|
2024-03-06 03:59:16 +03:00
|
|
|
@router.get("/users", response_model=list[UserSchema])
|
2024-03-04 07:12:29 +03:00
|
|
|
@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-06 03:59:16 +03:00
|
|
|
) -> list[UserSchema]:
|
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"}
|