22
33import clap .server .application .port .inbound .admin .UpdateCategoryUsecase ;
44import clap .server .application .port .outbound .member .LoadMemberPort ;
5+ import clap .server .application .port .outbound .task .CommandCategoryPort ;
56import clap .server .application .port .outbound .task .LoadCategoryPort ;
67import clap .server .common .annotation .architecture .ApplicationService ;
78import clap .server .domain .model .member .Member ;
9+ import clap .server .domain .model .task .Category ;
810import clap .server .exception .ApplicationException ;
911import lombok .RequiredArgsConstructor ;
1012import org .springframework .transaction .annotation .Transactional ;
1719public 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