Skip to content

Commit fd51c06

Browse files
committed
feat: yml부분(코드리뷰) 수정 완료
1 parent 8a6786f commit fd51c06

3 files changed

Lines changed: 11 additions & 9 deletions

File tree

src/main/java/com/back/web7_9_codecrete_be/domain/location/controller/KakaoApiController.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import com.back.web7_9_codecrete_be.domain.location.dto.response.KakaoLocalResponse;
44
import com.back.web7_9_codecrete_be.domain.location.dto.response.KakaoMobilityResponse;
55
import com.back.web7_9_codecrete_be.domain.location.service.KakaoLocalService;
6+
import com.back.web7_9_codecrete_be.global.error.code.LocationErrorCode;
7+
import com.back.web7_9_codecrete_be.global.error.exception.BusinessException;
68
import com.back.web7_9_codecrete_be.global.rsData.RsData;
79
import io.swagger.v3.oas.annotations.Operation;
810
import io.swagger.v3.oas.annotations.Parameter;
@@ -95,7 +97,7 @@ public List<KakaoMobilityResponse.Guide> navigateGuides(
9597
.toList();
9698
}
9799
@GetMapping("/navigate/summary")
98-
public List<KakaoMobilityResponse.Guide> navigateSummary(
100+
public KakaoMobilityResponse.Summary navigateSummary(
99101
@RequestParam double startX,
100102
@RequestParam double startY,
101103
@RequestParam double endX,
@@ -104,18 +106,16 @@ public List<KakaoMobilityResponse.Guide> navigateSummary(
104106
KakaoMobilityResponse res = kakaoLocalService.NaviSearchSummary(startX, startY, endX, endY);
105107

106108
if (res == null || res.getRoutes() == null || res.getRoutes().isEmpty()) {
107-
return List.of();
109+
throw new BusinessException(LocationErrorCode.ROUTE_NOT_FOUND);
108110
}
109111

110112
KakaoMobilityResponse.Route route0 = res.getRoutes().get(0);
111-
if (route0.getSections() == null || route0.getSections().isEmpty()) {
112-
return List.of();
113+
if (route0.getSummary() == null) {
114+
throw new BusinessException(LocationErrorCode.ROUTE_NOT_FOUND);
113115
}
114116

115-
return route0.getSections().stream()
116-
.filter(section -> section.getGuides() != null && !section.getGuides().isEmpty())
117-
.flatMap(section -> section.getGuides().stream())
118-
.toList();
117+
return route0.getSummary();
118+
119119
}
120120
}
121121

src/main/java/com/back/web7_9_codecrete_be/global/config/WebClientConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class WebClientConfig {
3737
@Value("${tmap.base-url}")
3838
private String tmapBaseUrl;
3939

40-
@Value("${https://apis-navi.kakaomobility.com}")
40+
@Value("${kakao.mobility.base-url}")
4141
private String kakaoMobilityUrl;
4242

4343
@Bean

src/main/resources/application.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ tmap: #Tmap 대중교통 추천 api 키
5151
kakao: #Kakao map REST API 키
5252
base-url: https://dapi.kakao.com
5353
restapi-key: ${KAKAOMAP_API_KEY}
54+
mobility:
55+
base-url: https://apis-navi.kakaomobility.com
5456

5557
kopis:
5658
api-key: ${KOPIST_API_KEY}

0 commit comments

Comments
 (0)