diff --git a/backend/src/main/java/com/twtw/backend/domain/plan/mapper/PlanMapper.java b/backend/src/main/java/com/twtw/backend/domain/plan/mapper/PlanMapper.java index 7ed064b6..46483df1 100644 --- a/backend/src/main/java/com/twtw/backend/domain/plan/mapper/PlanMapper.java +++ b/backend/src/main/java/com/twtw/backend/domain/plan/mapper/PlanMapper.java @@ -39,14 +39,11 @@ PlanInfoResponse toPlanInfoResponse( GroupInfoResponse groupInfoResponse, List memberResponses); - @IterableMapping(elementTargetType = PlanInfoResponse.class) - List toPlanInfoResponses(List plans); - - @IterableMapping(qualifiedByName = "toPlaceDetails") + @IterableMapping(qualifiedByName = "toPlaceDetail") List toPlaceDetails(List placeClientDetails); - @Named("toPlaceDetails") + @Named("toPlaceDetail") @Mapping(target = "longitude", source = "x") @Mapping(target = "latitude", source = "y") - PlaceDetails toPlaceDetails(PlaceClientDetails placeClientDetails); + PlaceDetails toPlaceDetail(PlaceClientDetails placeClientDetails); } diff --git a/backend/src/main/java/com/twtw/backend/domain/plan/service/PlanService.java b/backend/src/main/java/com/twtw/backend/domain/plan/service/PlanService.java index c3dc860d..561a81c2 100644 --- a/backend/src/main/java/com/twtw/backend/domain/plan/service/PlanService.java +++ b/backend/src/main/java/com/twtw/backend/domain/plan/service/PlanService.java @@ -99,6 +99,10 @@ public void outPlan(PlanMemberRequest request) { public PlanInfoResponse getPlanById(UUID id) { Plan plan = getPlanEntity(id); + return getPlanInfoResponse(plan); + } + + private PlanInfoResponse getPlanInfoResponse(final Plan plan) { GroupInfoResponse groupInfo = groupService.getGroupInfoResponse(plan.getGroup()); PlaceClientDetails placeDetails = placeService.getPlaceDetails(plan.getPlace()); @@ -122,7 +126,7 @@ public Plan getPlanEntity(UUID id) { public List getPlans() { final Member member = authService.getMemberByJwt(); final List plans = planRepository.findAllByMember(member); - return planMapper.toPlanInfoResponses(plans); + return plans.stream().map(this::getPlanInfoResponse).toList(); } public void updatePlan(final UpdatePlanRequest updatePlanRequest) {