service_man/api/presentation/routers/user.py

23 lines
616 B
Python
Raw Normal View History

2024-03-31 04:18:41 +03:00
from typing import Annotated
2024-03-31 01:36:57 +03:00
2024-03-31 04:18:41 +03:00
from fastapi import APIRouter, Depends
from api.application.contracts.user import UserCreateRequest, UserResponse
from api.application.usecase.create_user import CreateUser
from api.infrastructure.dependencies.stub import Stub
2024-03-31 01:36:57 +03:00
user_router = APIRouter(prefix="/users", tags=["Users"])
@user_router.get("/")
async def get_all_users() -> list[UserResponse]:
return []
2024-03-31 04:18:41 +03:00
2024-03-31 21:07:59 +03:00
@user_router.post("/", status_code=201)
async def create_user(
2024-03-31 04:18:41 +03:00
request: UserCreateRequest,
usecase: Annotated[CreateUser, Depends(Stub(CreateUser))],
) -> None:
return await usecase.execute(request)