-
Notifications
You must be signed in to change notification settings - Fork 1
[refactor] 대중교통 길찾기 api의 속도 개선 #175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
15dc5f8
bad8822
8e2a156
69b82a0
a0b8988
eedade7
f079f3a
8242123
341f573
98962d3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| package com.wayble.server.direction.dto; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| import com.wayble.server.direction.dto.response.TransportationResponseDto; | ||
| import com.wayble.server.direction.entity.type.DirectionType; | ||
|
|
||
| // 대중교통 길찾기에 사용하기 위한 내부용 DTO | ||
| public record InternalStep( | ||
| DirectionType mode, | ||
| List<TransportationResponseDto.MoveInfo> moveInfo, | ||
| String routeName, | ||
| Integer moveNumber, | ||
| TransportationResponseDto.BusInfo busInfo, | ||
| TransportationResponseDto.SubwayInfo subwayInfo, | ||
| String from, | ||
| String to, | ||
| Long routeId, | ||
| NodeRef startNode, | ||
| NodeRef endNode | ||
| ) {} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package com.wayble.server.direction.dto; | ||
|
|
||
| public record NodeRef( | ||
| Long id, | ||
| String stationName, | ||
| Double latitude, | ||
| Double longitude | ||
| ) {} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package com.wayble.server.direction.repository; | ||
|
|
||
| import com.wayble.server.direction.entity.type.DirectionType; | ||
|
|
||
| public interface EdgeBoundingBoxProjection { | ||
| Long getEdgeId(); | ||
| Long getStartNodeId(); | ||
| Long getEndNodeId(); | ||
| DirectionType getEdgeType(); | ||
| String getStartStationName(); | ||
| Double getStartLatitude(); | ||
| Double getStartLongitude(); | ||
| String getEndStationName(); | ||
| Double getEndLatitude(); | ||
| Double getEndLongitude(); | ||
| Long getRouteId(); | ||
| String getRouteName(); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package com.wayble.server.direction.repository; | ||
|
|
||
| import com.wayble.server.direction.entity.type.DirectionType; | ||
|
|
||
| public interface NodeBoundingBoxProjection { | ||
| Long getId(); | ||
| String getStationName(); | ||
| DirectionType getNodeType(); | ||
| Double getLatitude(); | ||
| Double getLongitude(); | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,9 +1,14 @@ | ||||||||||
| package com.wayble.server.direction.repository; | ||||||||||
|
|
||||||||||
| import org.springframework.data.jpa.repository.JpaRepository; | ||||||||||
| import org.springframework.data.jpa.repository.Query; | ||||||||||
| import org.springframework.data.repository.query.Param; | ||||||||||
|
|
||||||||||
| import com.wayble.server.direction.entity.transportation.Route; | ||||||||||
| import java.util.Optional; | ||||||||||
|
|
||||||||||
| public interface RouteRepository extends JpaRepository<Route, Long>{ | ||||||||||
|
|
||||||||||
| @Query("SELECT r.routeName FROM Route r WHERE r.routeId = :routeId") | ||||||||||
| Optional<String> findRouteNameById(@Param("routeId") Long routeId); | ||||||||||
|
Comment on lines
+12
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chain메서드 명칭을 더 구체적으로: byId → byRouteId JPA 기본 메서드(findById)와 의미가 혼동될 수 있어, byRouteId로의 리네이밍을 제안합니다. 기능 변화는 없습니다. 적용 diff: - @Query("SELECT r.routeName FROM Route r WHERE r.routeId = :routeId")
- Optional<String> findRouteNameById(@Param("routeId") Long routeId);
+ @Query("SELECT r.routeName FROM Route r WHERE r.routeId = :routeId")
+ Optional<String> findRouteNameByRouteId(@Param("routeId") Long routeId);호출부 업데이트 필요 여부를 아래로 확인해 주세요: 🏁 Script executed: #!/bin/bash
# 메서드 사용처 확인
rg -n '\bfindRouteNameById\b' -C2Length of output: 1679 메서드명 변경 시 호출부도 함께 갱신 필요 리팩토링한 메서드명(findRouteNameByRouteId)을 실제 호출부에서도 반영해야 합니다. 아래 위치에서
적용 예시: --- a/src/main/java/com/wayble/server/direction/repository/RouteRepository.java
@@ -11,7 +11,7 @@
@Query("SELECT r.routeName FROM Route r WHERE r.routeId = :routeId")
- Optional<String> findRouteNameById(@Param("routeId") Long routeId);
+ Optional<String> findRouteNameByRouteId(@Param("routeId") Long routeId);--- a/src/main/java/com/wayble/server/direction/service/BusInfoService.java
@@ -33,7 +33,7 @@
if (busId != null) {
- var routeName = routeRepository.findRouteNameById(busId);
+ var routeName = routeRepository.findRouteNameByRouteId(busId);
isShuttleBus = routeName.isPresent() && routeName.get().contains("마포");
}
@@ -148,7 +148,7 @@
// busId로 route 정보 조회
- var routeName = routeRepository.findRouteNameById(busId);
+ var routeName = routeRepository.findRouteNameByRouteId(busId);
String projectRouteName = routeName.orElse(null);이렇게 변경하면 JPA 기본 메서드와의 혼동을 피하고, 메서드 의도가 더 명확해집니다. 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
| } | ||||||||||
Uh oh!
There was an error while loading. Please reload this page.