from api.application.abstractions import UnitOfWork from api.application.contracts.user.user_request import UserCreateRequest from api.domain.user.model import User from api.domain.user.repository import UserRepository class CreateUser: def __init__(self, uow: UnitOfWork, user_repository: UserRepository) -> None: self.uow = uow self.user_repository = user_repository async def execute(self, request: UserCreateRequest) -> None: user = User.create(name=request.name, email=request.email, password=request.password) await self.user_repository.create_user(user=user) await self.uow.commit()