[Feat] 어드민 코스 생성/삭제 API 추가 (지도 좌표 기반) - #428
Merged
Merged
Conversation
- POST /api/admin/courses — 좌표 목록으로 코스 생성
- DELETE /api/admin/courses/{courseId} — 참조가 있으면 409 로 거부
- Course.create(...) 정적 팩토리 추가 (빌더·생성자가 모두 PROTECTED 였음)
- haversine 을 common/util/GeoDistance 로 공용화하고 CourseSummitDistanceCalculator 가 사용
코스는 그동안 시드 마이그레이션으로만 들어가는 데이터였다. 테스트 코스를 넣으려고
운영 DB 에 직접 SQL 을 쓰면 이력이 남지 않아 나중에 복구가 안 된다(V6 사례).
distance 는 요청으로 받지 않고 서버가 좌표로 계산한다. 트래킹 누적 거리와 같은 공식이어야
사진 마일스톤 푸시 지점이 어긋나지 않아서, 이미 4곳에 흩어져 있던 haversine 사본을
GeoDistance 로 모으고 그것만 쓰게 했다.
고도는 저장하지 않는다. 지도 클릭으로는 위경도만 얻기 때문이다. altitudes 가 null 이면
CourseSlopeSegmentCalculator 가 빈 세그먼트를 돌려주므로 경사도 그래프만 비고 코스 상세는
정상 동작한다. 대신 찍은 좌표 중 하나를 정상으로 지정해 summit_lat/lng 를 채운다.
polyline 은 SRID 4326 으로 만든다. src/main 에서 JTS 지오메트리를 생성하는 첫 사례라
SRID 를 빠뜨리면 geography 컬럼과 어긋나므로 테스트로 4326 을 검증한다.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Contributor
📊 테스트 커버리지 리포트
|
Contributor
Author
|
바로 머지해버리기~~~~~ |
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.
🧾 요약
🔗 이슈
✨ 변경 내용
POST /api/admin/courses— 좌표 목록으로 코스 생성,data는 생성된 courseId (201)DELETE /api/admin/courses/{courseId}— 참조가 있으면 409 로 거부Course.create(...)정적 팩토리 추가 (빌더·생성자가 모두 PROTECTED 라 생성이 불가능했음)common/util/GeoDistance로 공용화하고CourseSummitDistanceCalculator가 사용하도록 교체AdminCourseServiceTest11,GeoDistanceTest5,AdminCourseControllerTest2)✅ 확인