refactor: 스탬프 수집을 진행도 기반으로 변경하여 해외 여정 지원#149
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 변경 사항
스탬프 수집 로직을 실제 GPS 위치 기반에서 진행도(누적 거리) 기반으로 변경하여 해외 여정(파리, 뉴욕 등)에서도 스탬프 수집이 가능하도록 개선했습니다.
변경 이유
기존 문제점
해결 방안
distanceFromStart에 도달하면 수집 가능주요 변경 내용
1. Service Layer (
StampServiceImpl.java)COLLECTION_RADIUS_KM상수 삭제calculateDistance()(Haversine 거리 계산) 메서드 삭제collectStamp()- 실제 위치 검증 로직 제거canCollectStamp()- 진행률 기반 검증으로 변경✅ 수집 조건 (변경 후)
검증 항목:
제거된 검증:
예상 플로우
프론트엔드
// 러닝 완료 → 여정 진행률 업데이트 (currentDistanceKm 증가)
// 랜드마크 목록 순회하면서 자동 체크
if (currentDistanceKm >= landmark.distanceFromStart) {
// 스탬프 수집 가능!
POST /v1/stamps/collect {
progressId: 1,
landmarkId: 5,
collectionLocation: { ... } // 선택적 (저장용)
}
}
백엔드
// 진행률 기반 검증
if (progress.getCurrentDistanceKm() < landmark.getDistanceFromStart()) {
throw new IllegalArgumentException(
"아직 이 랜드마크에 도달하지 않았습니다. (현재: 30.5km, 필요: 50.0km)"
);
}
API 변경
Before
GET /v1/stamps/check-collection?progressId=1&landmarkId=5&latitude=48.8584&longitude=2.2945
After
GET /v1/stamps/check-collection?progressId=1&landmarkId=5
테스트 체크리스트
보안 고려사항
Q: 프론트엔드만 믿으면 조작 가능하지 않나요?
A: 백엔드에서 진행률 검증으로 방어합니다.
관련 이슈
배포 영향도
리뷰 포인트