Coverage for app/ddd/application/usecase/group/patch_group_usecase.py: 56%
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.group import PatchGroupInputDTO, PatchGroupOutputDTO
2from app.ddd.application.usecase.group.base_group_usecase import BaseGroupUseCase
3from app.ddd.domain import GroupId
6class PatchGroupUseCase(BaseGroupUseCase[PatchGroupInputDTO, PatchGroupOutputDTO]):
7 def execute(self, input_dto: PatchGroupInputDTO) -> PatchGroupOutputDTO:
8 group_id = GroupId(root=input_dto.group_id)
9 group = self._uow.group_repository.find_by_id(group_id)
10 group.sqlmodel_update(input_dto.model_dump(exclude_unset=True))
11 # hashed_password=create_hashed_password(str(group.group_password))
12 # # print(hashed_password)
13 # group.group_password = hashed_password
14 # with self._uow:
15 # self._uow.group_repository.update(group)
16 return PatchGroupOutputDTO.model_validate(group)