작업 목적
PetType enum과 PetCatalog 컬렉션이 동일한 사실("어떤 펫 종이 존재하는가")을 두 군데서 표현하는 중복 구조 제거. PetCatalog를 단일 권위로 통일.
핵심 변경
도메인
PetType.kt 파일 삭제
Pet.type: PetType → Pet.type: String
DailyInfo.petType: PetType? → String?
Service
PetService: 진입에서 petCatalogService.requireActive(petType) 검증, 랜덤 선택은 pickRandomActiveExcluding로 교체
MonthlyRankingService: PetType.toKorean() when 제거, petCatalogService.getName(key)로 조회
StatsAdminRepositoryImpl: PetType.valueOf 제거, key 그대로 사용
PetCatalogService 신규 메서드
pickRandomActiveExcluding(excluded): String
getName(key): String?
requireActive(key) — PetCatalogInactiveException 신설
DTO
타입만 PetType → String으로 교체. 필드명·JSON 키 모두 보존 (wire-shape 동일성).
안전성
- DB 마이그레이션 불요: Spring Data MongoDB가 enum을 이미
.name string으로 직렬화 중. 코드 타입만 String으로 바꾸면 그대로 읽힘.
- wire-shape 동일: 클라이언트(iOS/Android) 무영향.
- 롤백: 코드 롤백만으로 복구.
검증
- 컴파일 +
./gradlew test 전체 통과
rg "PetType" 결과 0건
- 어드민/가입/랭킹 흐름의 wire-shape JSON 동일
작업 목적
PetTypeenum과PetCatalog컬렉션이 동일한 사실("어떤 펫 종이 존재하는가")을 두 군데서 표현하는 중복 구조 제거. PetCatalog를 단일 권위로 통일.핵심 변경
도메인
PetType.kt파일 삭제Pet.type: PetType→Pet.type: StringDailyInfo.petType: PetType?→String?Service
PetService: 진입에서petCatalogService.requireActive(petType)검증, 랜덤 선택은pickRandomActiveExcluding로 교체MonthlyRankingService:PetType.toKorean()when 제거,petCatalogService.getName(key)로 조회StatsAdminRepositoryImpl:PetType.valueOf제거, key 그대로 사용PetCatalogService 신규 메서드
pickRandomActiveExcluding(excluded): StringgetName(key): String?requireActive(key)—PetCatalogInactiveException신설DTO
타입만
PetType→String으로 교체. 필드명·JSON 키 모두 보존 (wire-shape 동일성).안전성
.namestring으로 직렬화 중. 코드 타입만 String으로 바꾸면 그대로 읽힘.검증
./gradlew test전체 통과rg "PetType"결과 0건