Repository navigation
refactor: 같은 일을 하는 엔드포인트 7개를 지운다 - #137
Merged
Merged
Conversation
Map<String, Object> 응답 24곳을 DTO 로 바꾸려고 하나씩 읽다가, 그중 7곳은
타입을 붙일 값이 아니라는 것을 알았다. 이미 같은 일을 하는 엔드포인트가 있었다.
지운 것 → 남겨 둔 것
- POST /api/public/care-facilities/sync-all
- GET /api/public/care-facilities/swagger/sync
→ POST /api/admin/public-data/facilities/sync
지운 쪽은 컨트롤러가 리포지토리에 직접 쓰고 50페이지 루프를 돌렸다. 남긴 쪽은
SyncResult 로 신규·갱신·실패·제외를 세고 신선도 이력(SyncRunTracker)에 남긴다.
swagger/sync 는 GET 이라 브라우저 접속이나 크롤러만으로 DB 쓰기가 실행됐다.
- GET /api/public/care-facilities/swagger/db-facilities → GET /facilities
- GET /api/public/care-facilities/swagger/stats → GET /facilities/statistics
success/message 로 한 겹 더 싼 것 말고 차이가 없었다.
- GET /notifications/settings/{userId} → GET /notifications/preferences
- PUT /notifications/settings/{userId} → PUT /notifications/preferences/...
- GET /notifications/statistics/{userId} → GET /notifications/stats
알림 쪽 세 개는 값이 코드에 박혀 있었다. 설정 조회는 고정값(이메일 켬, 조용한 시간
22:00-08:00)을 돌려주고, 설정 수정은 받은 값을 그대로 돌려주며 아무것도 저장하지
않았다. 통계는 우선순위 분포 HIGH=5, NORMAL=15, LOW=5 와 일별 건수 2024-01-15: 3 이
박혀 있었다. 응답이 그럴듯하면 프런트는 설정이 저장된다고 읽는다. 타입을 붙이면
그 거짓이 스펙에 정식으로 올라가므로, 타입화가 아니라 삭제가 맞다.
입구가 둘이면 보안 설정도 둘이다. /api/public/care-facilities/** 가 통째로 permitAll
이어서 그 아래 동기화 트리거까지 열려 있었고, 경로마다 hasRole("ADMIN") 을 덧붙여
막아 둔 상태였다. 중복을 지우면서 그 예외도 함께 사라졌다.
되살아나는 것을 막으려고 AccessControlContractTest.duplicateMappingsRemoved 가 일곱
경로를 두드려 404/405 를 확인한다. 동기화가 ADMIN 전용인지 보던 테스트는 남은
어드민 경로로 옮겼다.
- OpenAPI 스펙: 237 → 231 경로
- ArchUnit baseline: 391 → 383 (컨트롤러→리포지토리 66→61, 도메인 경계 271→268)
- 전체 테스트 607개, 실패 0
Refs #132
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.
Refs #132 (3a 단계)
Map<String, Object>응답 24곳을 DTO 로 바꾸려고 하나씩 읽다가, 그중 7곳은 타입을 붙일 값이 아니라는 것을 알았습니다. 이미 같은 일을 하는 엔드포인트가 있었습니다.POST /api/public/care-facilities/sync-allPOST /api/admin/public-data/facilities/syncSyncResult로 집계하고 신선도 이력에 남긴다GET /api/public/care-facilities/swagger/syncGET .../swagger/db-facilitiesGET /facilitiessuccess/message로 한 겹 더 싼 것 말고 차이가 없다GET .../swagger/statsGET /facilities/statisticsGET /notifications/settings/{userId}GET /notifications/preferencesPUT /notifications/settings/{userId}PUT /notifications/preferences/...GET /notifications/statistics/{userId}GET /notifications/statsHIGH=5, NORMAL=15, LOW=5, 일별 건수2024-01-15: 3이 코드에 박혀 있었다알림 쪽 세 개가 핵심입니다. 응답이 그럴듯하면 프런트는 설정이 저장된다고 읽습니다. 타입을 붙이면 그 거짓이 스펙에 정식으로 올라가므로, 타입화가 아니라 삭제가 맞습니다.
입구가 둘이면 보안 설정도 둘입니다.
/api/public/care-facilities/**가 통째로permitAll이어서 그 아래 동기화 트리거까지 열려 있었고, 경로마다hasRole("ADMIN")을 덧붙여 막아 둔 상태였습니다. 중복을 지우면서 그 예외도 함께 사라졌습니다.되살아나지 않게
AccessControlContractTest.duplicateMappingsRemoved가 일곱 경로를 모두 두드려 404/405 를 확인합니다. 동기화가 ADMIN 전용인지 보던 테스트는 남은 어드민 경로로 옮겼습니다.숫자
프런트 영향
없습니다.
CareCode_FE가 이 일곱 경로를 부르는 곳은 없습니다(/notifications/preferences와/facilities를 씁니다).