[hotfix] #88 - 회원가입 시 이용약관 동의 여부 저장#89
Conversation
Walkthrough
Changes온보딩 약관 동의 흐름
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 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
🧹 Nitpick comments (1)
src/main/java/com/Timo/Timo/domain/user/exception/UserErrorCode.java (1)
12-15: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
USER_INVALID_TIME과INVALID_TIMEZONE이 동일한code값을 공유두 에러 코드 모두
"USER_400"을code필드로 사용하고 있어, 클라이언트 측에서 응답의code만으로는 어떤 검증 실패인지 구분할 수 없습니다.message로만 구분 가능하므로, 클라이언트가 프로그래밍 방식으로 에러를 분기해야 한다면 고유한 code 값(예:"USER_400_INVALID_TIME","USER_400_INVALID_TIMEZONE")을 사용하는 것을 권장합니다.🤖 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/Timo/Timo/domain/user/exception/UserErrorCode.java` around lines 12 - 15, Update the enum constants USER_INVALID_TIME and INVALID_TIMEZONE in UserErrorCode so they no longer share the same code value; assign each a distinct, descriptive code such as USER_400_INVALID_TIME and USER_400_INVALID_TIMEZONE while preserving their existing HTTP statuses and messages.
🤖 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/main/java/com/Timo/Timo/domain/user/entity/User.java`:
- Around line 77-78: termsAgreed 필드의 terms_agreed 컬럼을 엔티티에 추가하기 전에 데이터베이스
마이그레이션을 추가하세요. 기존 users 행에는 false를 backfill하고 신규 행의 기본값도 false로 설정한 뒤 NOT NULL
제약을 적용하여, 프로덕션의 ddl-auto: validate가 통과하도록 스키마 변경을 구성하세요.
---
Nitpick comments:
In `@src/main/java/com/Timo/Timo/domain/user/exception/UserErrorCode.java`:
- Around line 12-15: Update the enum constants USER_INVALID_TIME and
INVALID_TIMEZONE in UserErrorCode so they no longer share the same code value;
assign each a distinct, descriptive code such as USER_400_INVALID_TIME and
USER_400_INVALID_TIMEZONE while preserving their existing HTTP statuses and
messages.
🪄 Autofix (Beta)
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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: db6d85be-4f79-4db5-aeb4-8f0168ec8cd2
⛔ Files ignored due to path filters (1)
src/main/java/com/Timo/Timo/domain/user/docs/OnboardingControllerDocs.javais excluded by!**/docs/**
📒 Files selected for processing (4)
src/main/java/com/Timo/Timo/domain/user/dto/request/OnboardingRequest.javasrc/main/java/com/Timo/Timo/domain/user/entity/User.javasrc/main/java/com/Timo/Timo/domain/user/exception/UserErrorCode.javasrc/main/java/com/Timo/Timo/domain/user/service/OnboardingService.java
| @Column(name = "terms_agreed", nullable = false) | ||
| private boolean termsAgreed; |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# 마이그레이션 스크립트 존재 여부 및 terms_agreed 컬럼 정의 확인
fd -e sql . src/main/resources 2>/dev/null | head -20
rg -n "terms_agreed" src/main/resources/Repository: Team-Timo/Timo-Server
Length of output: 159
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== resources tree =="
find src/main/resources -maxdepth 3 -type f | sort | sed -n '1,120p'
echo
echo "== User entity excerpt =="
sed -n '1,140p' src/main/java/com/Timo/Timo/domain/user/entity/User.java
echo
echo "== migration/config references =="
rg -n "flyway|liquibase|ddl-auto|terms_agreed|schema.sql|data.sql" src/main/resources src/main/java -S || trueRepository: Team-Timo/Timo-Server
Length of output: 4162
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== application.yml =="
sed -n '1,120p' src/main/resources/application.yml
echo
echo "== application-local.yml =="
sed -n '1,120p' src/main/resources/application-local.yml
echo
echo "== application-prod.yml =="
sed -n '1,120p' src/main/resources/application-prod.ymlRepository: Team-Timo/Timo-Server
Length of output: 3268
terms_agreed 컬럼 마이그레이션을 먼저 추가하세요
프로덕션은 ddl-auto: validate라서 이 NOT NULL 컬럼이 DB에 먼저 반영돼 있어야 합니다. 기존 users 행이 있으면 배포가 막힐 수 있으니, terms_agreed를 false로 backfill/DEFAULT 처리하는 스키마 변경을 같이 넣어주세요.
🤖 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/Timo/Timo/domain/user/entity/User.java` around lines 77 -
78, termsAgreed 필드의 terms_agreed 컬럼을 엔티티에 추가하기 전에 데이터베이스 마이그레이션을 추가하세요. 기존 users
행에는 false를 backfill하고 신규 행의 기본값도 false로 설정한 뒤 NOT NULL 제약을 적용하여, 프로덕션의 ddl-auto:
validate가 통과하도록 스키마 변경을 구성하세요.
Source: Path instructions
laura-jung
left a comment
There was a problem hiding this comment.
아주 좋네요 ddl-auto는 update로 수정해두어서 괜찮을 것 같습니다 굳굳
aneykrap
left a comment
There was a problem hiding this comment.
빠르게 처리해주셔서 감사합니다.
확인했습니당
관련 이슈 🛠
작업 내용 요약 ✏️
회원가입(온보딩) 시 이용약관 동의 여부를 저장하는 기능 추가. 별도의 약관 동의 API 없이, 온보딩 완료 시점에 자동으로 동의 처리됩니다.
주요 변경 사항 🛠️
User엔티티에termsAgreed필드 추가 (기본값 false)completeOnboarding()호출 시termsAgreed를true로 함께 설정OnboardingResponse에termsAgreed필드 추가트러블 슈팅 ⚽️
약관 동의를 받는 시점 결정
termsAgreed필드를 별도로 받아 검증(@AssertTrue)하는 방식으로 설계했으나, 논의 후 별도 체크박스 없이 온보딩 완료 자체가 곧 약관 동의라는 정책으로 확정되어 요청 필드 추가 없이 서버에서 자동으로 처리하도록 단순화테스트 결과 📄
termsAgreed가true로 변경되는지 DB 확인스크린샷 📷
리뷰 요구사항 📢
프로덕션 ddl-auto=validate 환경에서의 스키마 반영 누락 발견
ddl-auto: validate로 설정되어 있어 엔티티에 컬럼을 추가하는 것만으로는 배포가 불가능하다는 점을 확인validate모드는 Hibernate가 스키마를 자동 생성하지 않고 엔티티-DB 스키마 일치 여부만 검증하기 때문에,terms_agreed컬럼이 실제 DB에 먼저 반영되지 않으면 서버 시작 자체가 실패함DEFAULT FALSE를 지정한 마이그레이션을 별도로 추가 필요:-> 참고해주세용
📎 참고 자료 (선택)
Summary by CodeRabbit
새 기능
버그 수정