Repository navigation
feat: region-seed 추가 - #61
Conversation
📝 WalkthroughWalkthroughThe change adds transactional startup seeding for Seoul and its 25 districts. Repository queries locate existing regions. JPA tests verify complete, repeated, and partial initialization without duplicates. ChangesRegion data seeding
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant ApplicationStartup
participant RegionDataInitializer
participant RegionRepository
participant RegionDatabase
ApplicationStartup->>RegionDataInitializer: run(ApplicationArguments)
RegionDataInitializer->>RegionRepository: find Seoul and existing districts
RegionRepository->>RegionDatabase: execute region queries
RegionDataInitializer->>RegionRepository: save missing regions
RegionRepository->>RegionDatabase: persist Seoul region data
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@src/test/java/com/daytodo/domain/region/config/RegionDataInitializerTest.java`:
- Around line 64-68: Add a test case alongside
insertsOnlyMissingDistrictsWhenSomeDataAlreadyExists that seeds an existing SIDO
named "서울", runs RegionDataInitializer.run, and verifies the legacy root remains
the sole root with exactly 25 districts. Use the existing repository and
assertion patterns without changing initializer behavior.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 8abdbd84-0bbe-4df9-979b-eeac11209e5c
📒 Files selected for processing (3)
src/main/java/com/daytodo/domain/region/config/RegionDataInitializer.javasrc/main/java/com/daytodo/domain/region/repository/RegionRepository.javasrc/test/java/com/daytodo/domain/region/config/RegionDataInitializerTest.java
| void insertsOnlyMissingDistrictsWhenSomeDataAlreadyExists() throws Exception { | ||
| Region seoul = regionRepository.save(new Region(null, "서울특별시", RegionLevel.SIDO)); | ||
| regionRepository.save(new Region(seoul, "종로구", RegionLevel.SIGUNGU)); | ||
|
|
||
| new RegionDataInitializer(regionRepository).run(null); |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Add coverage for the legacy 서울 root.
The tests do not verify the stated behavior for an existing SIDO named "서울". Add a case that seeds this root, runs the initializer, and verifies that it remains the only root and has 25 districts.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@src/test/java/com/daytodo/domain/region/config/RegionDataInitializerTest.java`
around lines 64 - 68, Add a test case alongside
insertsOnlyMissingDistrictsWhenSomeDataAlreadyExists that seeds an existing SIDO
named "서울", runs RegionDataInitializer.run, and verifies the legacy root remains
the sole root with exactly 25 districts. Use the existing repository and
assertion patterns without changing initializer behavior.
🔗 관련 이슈
📝 What is this PR?
애플리케이션 실행 시 서울특별시와 25개 자치구 데이터를 자동으로 초기화합니다.
✨ Changes
ApplicationRunner기반의RegionDataInitializer를 추가했습니다.SIDO레벨로 생성합니다.SIGUNGU레벨로 생성합니다."서울"로 저장된 데이터도 서울 지역으로 인식하도록 처리했습니다.🧪 Result
RegionDataInitializerTest테스트 3건 통과BUILD SUCCESSFUL👀 To. Reviewer
"서울"데이터와"서울특별시"데이터를 함께 고려한 중복 방지 로직을 집중적으로 확인 부탁드립니다.✅ 체크 리스트
Summary by CodeRabbit