service_man/api/presentation/routers/user.py

23 lines
604 B
Python

from typing import Annotated
from fastapi import APIRouter, Depends
from api.application.contracts.user import UserCreateRequest, UserResponse
from api.application.usecase.user.create_user import CreateUser
from api.infrastructure.dependencies.stub import Stub
user_router = APIRouter(prefix="/users", tags=["Users"])
@user_router.get("/")
async def get_all_users() -> list[UserResponse]:
return []
@user_router.post("/")
async def create_user(
request: UserCreateRequest,
usecase: Annotated[CreateUser, Depends(Stub(CreateUser))],
) -> None:
return await usecase.execute(request)