Skip to content

[UNI-73] refactor : 길찾기 로직 응답형태 리팩토링#25

Merged
thdgustjd1 merged 3 commits intobefrom
feat/UNI-73
Feb 1, 2025
Merged

[UNI-73] refactor : 길찾기 로직 응답형태 리팩토링#25
thdgustjd1 merged 3 commits intobefrom
feat/UNI-73

Conversation

@thdgustjd1
Copy link
Copy Markdown
Collaborator

@thdgustjd1 thdgustjd1 commented Jan 31, 2025

📝 PR 타입

  • 기능 구현
  • 기능 수정
  • 버그 수정
  • 리팩토링
  • 인프라, 의존성, 환경 변수, 빌드 관련 코드 업데이트

🚀 변경 사항

  1. 차량 내비게이션 길찾기 형태에서 도보 길찾기 상세정보 형태로 응답을 변경하였습니다.
  2. 길찾기 결과의 노드순서를 정렬하였습니다.
  3. 길 상세정보 조회에서 갈림길에 해당하는 노드의 좌표를 추가하였습니다.

🧪 테스트 결과

image

- (10 20, 20 30) (40 30, 20 30) 형태에서 (10 20, 20 30) (20 30, 40 30) 형태로
- FE와의 협의로 길 상세정보에 갈림길 노드좌표 포함하는 형태로 변경
- 차량 내비게이션이 아니라 도보 상세정보 형태로 응답 변경
@thdgustjd1 thdgustjd1 added 💡 refactor 기능 개선 🫀 be 백엔드 task labels Jan 31, 2025
@thdgustjd1 thdgustjd1 requested a review from mikekks January 31, 2025 11:25
@thdgustjd1 thdgustjd1 self-assigned this Jan 31, 2025
Copy link
Copy Markdown
Collaborator

@mikekks mikekks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다 ~! 궁금한 부분 질문남겼습니다 !

Comment on lines +213 to +215
accumulatedDistance = calculateDistance(nowRoute)/2;
checkPointNodeCoordinates = getCenter(now, nxt);
checkPointType = DirectionType.CAUTION;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getCenter 메서드를 Route 내부로 넣어두는건 어떻게 생각하시는지 궁금합니다 !!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 그게 훨씬 더 좋은 방향인것 같습니다! 반영한 뒤 머지하겠습니다!!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

생각해보니 getCenter를 Route 내부에서 정의하게되면 메서드가

	public Map<String,Double> getCenter(){
		return Map.of("lat", (node1.getCoordinates().getY() + node2.getCoordinates().getY())/2
				, "lng", (node1.getCoordinates().getX() + node2.getCoordinates().getX())/2);
	}

이렇게 될텐데, 만약 Lazy loading 상태인(fetch join을 하지 않은) Route에서 getCenter를 호출할 경우 추가 쿼리문이 나갈 위험성이 있을것 같습니다.

게다가 현재 Route에서 node1, node2가 (fetch = LAZY) 로 선언되어있기 때문에 더더욱 추가 쿼리문의 가능성이 높아보입니다.

의견 남겨주시면 확인 후 머지하겠습니다!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

말씀주신 것에 동감합니다!

그래서 전 항상 기능 개발할때 "해당 기능에서 발생하는 쿼리도 의도대로 잘 동작하는지" 까지도 고려해서 기능개발하는 게 좋다고 생각하는데요! 어떻게 생각하시는지 궁금합니다!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

네 좋습니다! 의도대로 동작하는지 스스로도 점검하고, 앞으로 코드리뷰할때도 꼼꼼하게 보겠습니다!

@thdgustjd1 thdgustjd1 merged commit eb68ecf into be Feb 1, 2025
@thdgustjd1 thdgustjd1 deleted the feat/UNI-73 branch February 1, 2025 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🫀 be 백엔드 task 💡 refactor 기능 개선

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants