Skip to content

[refactor] PetType enum 제거, 펫 종 정보를 PetCatalog로 일원화 #305

Description

@ddingmin

작업 목적

PetType enum과 PetCatalog 컬렉션이 동일한 사실("어떤 펫 종이 존재하는가")을 두 군데서 표현하는 중복 구조 제거. PetCatalog를 단일 권위로 통일.

핵심 변경

도메인

  • PetType.kt 파일 삭제
  • Pet.type: PetTypePet.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

타입만 PetTypeString으로 교체. 필드명·JSON 키 모두 보존 (wire-shape 동일성).

안전성

  • DB 마이그레이션 불요: Spring Data MongoDB가 enum을 이미 .name string으로 직렬화 중. 코드 타입만 String으로 바꾸면 그대로 읽힘.
  • wire-shape 동일: 클라이언트(iOS/Android) 무영향.
  • 롤백: 코드 롤백만으로 복구.

검증

  • 컴파일 + ./gradlew test 전체 통과
  • rg "PetType" 결과 0건
  • 어드민/가입/랭킹 흐름의 wire-shape JSON 동일

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions