service_man/api/router/user.py

20 lines
467 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-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 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-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"}