[FEATURE]: 사용자 위치 기반으로 인기TOP 가맹점 위치 반환 - #34
Conversation
Summary of ChangesHello @Answl, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 PR은 사용자의 현재 위치를 기반으로 주변의 인기 TOP 10 가맹점 지점을 검색하는 새로운 지도 기능을 도입합니다. 이를 위해 가맹점 지점 정보를 저장하는 새로운 데이터 모델이 추가되었고, 지리적 거리 계산을 위한 하버사인 공식이 적용된 서비스 로직이 구현되었습니다. 또한, 해당 기능을 외부에 노출하기 위한 REST API 엔드포인트가 개발되었으며, 이 엔드포인트는 인증 없이 접근 가능하도록 보안 설정이 업데이트되었습니다. 이 변경 사항은 사용자에게 주변 상점 정보를 제공하는 데 중요한 역할을 할 것입니다. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
이 PR은 사용자의 위치를 기반으로 인기 TOP 10 가맹점의 위치를 반환하는 새로운 API를 구현합니다. 전반적으로 기능 구현은 잘 되었지만, 데이터베이스 조회 성능과 메모리 사용량 측면에서 개선할 수 있는 부분이 있습니다. NearbyMerchantService에서 모든 가맹점 위치를 가져와 메모리에서 필터링하는 현재 방식은 데이터가 많아질 경우 심각한 성능 저하를 유발할 수 있습니다. 또한, 스트림 처리 로직을 최적화하여 불필요한 객체 생성을 줄일 수 있습니다. 자세한 내용은 각 파일에 남긴 주석을 참고해주세요.
데이터베이스 수준에서 1차적인 필터링 진행 (Bounding Box)
|
/gemini review |
There was a problem hiding this comment.
Code Review
안녕하세요. 사용자 위치 기반으로 인기 가맹점 위치를 반환하는 API 구현 PR 잘 보았습니다.
전반적으로 새로운 기능의 요구사항이 잘 반영되었고, 코드 구조도 명확하게 잘 분리되어 있습니다.
몇 가지 코드 가독성 및 유지보수성 향상을 위한 제안을 드립니다.
NearbyMerchantService에서for루프와 가변 리스트를 사용하는 대신, Stream API를 활용하여 더 선언적이고 간결한 코드로 개선할 수 있습니다.- 또한, 유지보수 편의성을 위해 하드코딩된 Top 10 가맹점 목록을 외부 설정으로 분리하는 방안을 고려해보시면 좋을 것 같습니다.
자세한 내용은 각 파일의 주석을 참고해주세요.
📌 개요
사용자의 위치(위도, 경도, 반경)를 기반으로 DB에 저장된 가맹점 지점 중 Top10 가맹점에 해당하는 지점을
서버 Haversine 계산으로 필터링하여 최대 10개를 반환하는 지도 API를 구현합니다.
🔧 작업 내용
✅ 체크리스트
[GET] http://localhost:8080/api/v1/map/nearby-top10?latitude=37.5508&longitude=127.1268&radiusKm=0.07
{ "data": [ { "merchantRank": 1, "merchantName": "스타벅스", "placeName": "스타벅스00001점", "latitude": 37.5508103363035, "longitude": 127.12685944831, "distanceKm": 0.005365323624173253 }, { "merchantRank": 1, "merchantName": "스타벅스", "placeName": "스타벅스20989점", "latitude": 37.5512876939133, "longitude": 127.127018691186, "distanceKm": 0.05755411418274506 }, { "merchantRank": 1, "merchantName": "스타벅스", "placeName": "스타벅스01144점", "latitude": 37.5505124105179, "longitude": 127.1274134559, "distanceKm": 0.0628276692126367 }, { "merchantRank": 4, "merchantName": "올리브영", "placeName": "올리브영64046점", "latitude": 37.550566957873, "longitude": 127.126960885128, "distanceKm": 0.029540656753608393 }, { "merchantRank": 4, "merchantName": "올리브영", "placeName": "올리브영71201점", "latitude": 37.5512604691138, "longitude": 127.127199712113, "distanceKm": 0.06215537196390446 }, { "merchantRank": 4, "merchantName": "올리브영", "placeName": "올리브영89273점", "latitude": 37.5503863809105, "longitude": 127.127311392293, "distanceKm": 0.06440309211413094 }, { "merchantRank": 5, "merchantName": "다이소", "placeName": "다이소30252점", "latitude": 37.5511616274855, "longitude": 127.126950577162, "distanceKm": 0.0423455409563499 }, { "merchantRank": 5, "merchantName": "다이소", "placeName": "다이소17940점", "latitude": 37.5510168339572, "longitude": 127.127538797826, "distanceKm": 0.06944958752888943 }, { "merchantRank": 9, "merchantName": "파리바게뜨", "placeName": "파리바게뜨69935점", "latitude": 37.55104451016, "longitude": 127.126939061853, "distanceKm": 0.029824349010004032 }, { "merchantRank": 9, "merchantName": "파리바게뜨", "placeName": "파리바게뜨08285점", "latitude": 37.5504504354081, "longitude": 127.126394858823, "distanceKm": 0.05278728581169389 } ], "error": null, "status": 200 }📝 기타 참고 사항
시 해당 필드 수정 필요
📎 관련 이슈
Close #31