Coverage for app/ddd/application/usecase/user/create_user_usecase.py: 100%
9 statements
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-15 01:44 +0000
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-15 01:44 +0000
1from app.ddd.application.dto.user import CreateUserInputDTO, CreateUserOutputDTO
2from app.ddd.application.usecase.user.base_user_usecase import BaseUserUseCase
3from app.ddd.domain.model import User
4from app.ddd.infrastructure.auth.hash_password import create_hashed_password
7class CreateUserUseCase(BaseUserUseCase[CreateUserInputDTO, CreateUserOutputDTO]):
8 def execute(self, input_dto: CreateUserInputDTO) -> CreateUserOutputDTO:
9 user: User = User.model_validate(input_dto)
10 hashed_password=create_hashed_password(str(user.user_password))
11 print(hashed_password)
12 user.user_password = hashed_password
13 with self._uow:
14 self._uow.user_repository.insert(user)
15 return CreateUserOutputDTO.model_validate(user)