fix: 학교 이메일 중복 인증을 차단한다#808
Conversation
Walkthrough
Estimated code review effort: 3 (Moderate) | ~25 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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.
🧹 Nitpick comments (1)
src/main/java/com/example/solidconnection/siteuser/service/SchoolEmailService.java (1)
87-93: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueflush 예외를 조금 더 좁혀서 잡아도 좋을 것 같아요.
DataIntegrityViolationException을 무조건SCHOOL_EMAIL_ALREADY_USED로 변환하고 있는데, 현재 이 시점에 변경되는 필드가verifiedSchoolEmail/homeUniversityId뿐이라 실질 위험은 낮지만, 향후verifySchool호출 전후로 다른 unique 제약이 걸린 필드가 같은 트랜잭션에서 변경되면 원인이 다른 무결성 위반도 같은 메시지로 감춰질 수 있습니다. 급하게 고칠 사항은 아니고 참고 삼아 남깁니다.🤖 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/main/java/com/example/solidconnection/siteuser/service/SchoolEmailService.java` around lines 87 - 93, The flushVerifiedSchoolEmail method currently converts every DataIntegrityViolationException into SCHOOL_EMAIL_ALREADY_USED, which can hide unrelated unique-constraint failures. Narrow the handling by identifying the specific integrity violation tied to verifiedSchoolEmail/homeUniversityId inside SchoolEmailService, and only map that case to SCHOOL_EMAIL_ALREADY_USED while letting other DataIntegrityViolationException cases propagate or be handled separately.
🤖 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.
Nitpick comments:
In
`@src/main/java/com/example/solidconnection/siteuser/service/SchoolEmailService.java`:
- Around line 87-93: The flushVerifiedSchoolEmail method currently converts
every DataIntegrityViolationException into SCHOOL_EMAIL_ALREADY_USED, which can
hide unrelated unique-constraint failures. Narrow the handling by identifying
the specific integrity violation tied to verifiedSchoolEmail/homeUniversityId
inside SchoolEmailService, and only map that case to SCHOOL_EMAIL_ALREADY_USED
while letting other DataIntegrityViolationException cases propagate or be
handled separately.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 6e0e04b5-875b-4efe-8eee-7b4c3f5f51e8
📒 Files selected for processing (7)
src/main/java/com/example/solidconnection/common/exception/ErrorCode.javasrc/main/java/com/example/solidconnection/siteuser/domain/SiteUser.javasrc/main/java/com/example/solidconnection/siteuser/repository/SiteUserRepository.javasrc/main/java/com/example/solidconnection/siteuser/service/SchoolEmailService.javasrc/main/resources/db/migration/V57__add_verified_school_email_to_site_user.sqlsrc/test/java/com/example/solidconnection/siteuser/repository/SiteUserRepositoryTest.javasrc/test/java/com/example/solidconnection/siteuser/service/SchoolEmailServiceTest.java
관련 이슈
작업 내용
verified_school_email로 저장하도록 사용자 도메인과 DB 마이그레이션을 추가했습니다.verified_school_emailunique 제약과 저장 직후 flush 기반 예외 변환을 추가했습니다.특이 사항
site_user.verified_school_email은 nullable unique 컬럼입니다. 미인증 사용자는NULL상태로 유지되고, 인증 완료된 이메일만 중복 차단 대상이 됩니다.trim + lowerCase로 정규화합니다.bash gradlew test전체 테스트 통과를 확인했습니다.리뷰 요구사항 (선택)
verified_school_emailunique 제약과 서비스 중복 검증이 함께 필요한 구조인지 확인 부탁드립니다.SCHOOL_EMAIL_ALREADY_USED로 변환하는 방식이 적절한지 봐주세요.null카운트를 무시하는 방어 방식이 적절한지 확인 부탁드립니다.