Skip to content

Commit 280d930

Browse files
committed
CLAP-214 Hotifx : 카테고리 수정 로직 수정
<footer> - 관련: #216
1 parent 93531b5 commit 280d930

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/main/java/clap/server/application/service/admin/UpdateCategoryService.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
import clap.server.application.port.inbound.admin.UpdateCategoryUsecase;
44
import clap.server.application.port.outbound.member.LoadMemberPort;
5+
import clap.server.application.port.outbound.task.CommandCategoryPort;
56
import clap.server.application.port.outbound.task.LoadCategoryPort;
67
import clap.server.common.annotation.architecture.ApplicationService;
78
import clap.server.domain.model.member.Member;
9+
import clap.server.domain.model.task.Category;
810
import clap.server.exception.ApplicationException;
911
import lombok.RequiredArgsConstructor;
1012
import org.springframework.transaction.annotation.Transactional;
@@ -17,13 +19,15 @@
1719
public class UpdateCategoryService implements UpdateCategoryUsecase {
1820
private final LoadCategoryPort loadCategoryPort;
1921
private final LoadMemberPort loadMemberPort;
22+
private final CommandCategoryPort commandCategoryPort;
2023

2124
@Override
2225
@Transactional
2326
public void updateCategory(Long adminId, Long categoryId, String name, String code) {
2427
Member admin = loadMemberPort.findActiveMemberById(adminId).orElseThrow(() -> new ApplicationException(ACTIVE_MEMBER_NOT_FOUND));
25-
loadCategoryPort.findById(categoryId)
26-
.orElseThrow(() -> new ApplicationException(CATEGORY_NOT_FOUND))
27-
.updateCategory(admin, name, code);
28+
Category category = loadCategoryPort.findById(categoryId)
29+
.orElseThrow(() -> new ApplicationException(CATEGORY_NOT_FOUND));
30+
category.updateCategory(admin, name, code);
31+
commandCategoryPort.save(category);
2832
}
2933
}

0 commit comments

Comments
 (0)