Skip to content

[hotfix] #88 - 회원가입 시 이용약관 동의 여부 저장#89

Merged
Jy000n merged 2 commits into
developfrom
hotfix/#88/signup-terms
Jul 10, 2026
Merged

[hotfix] #88 - 회원가입 시 이용약관 동의 여부 저장#89
Jy000n merged 2 commits into
developfrom
hotfix/#88/signup-terms

Conversation

@Jy000n

@Jy000n Jy000n commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

관련 이슈 🛠

작업 내용 요약 ✏️

회원가입(온보딩) 시 이용약관 동의 여부를 저장하는 기능 추가. 별도의 약관 동의 API 없이, 온보딩 완료 시점에 자동으로 동의 처리됩니다.

주요 변경 사항 🛠️

  • [User] User 엔티티에 termsAgreed 필드 추가 (기본값 false)
  • [User] completeOnboarding() 호출 시 termsAgreedtrue로 함께 설정
    • 별도의 동의 여부 입력 필드나 검증 로직 없이, 온보딩 완료와 동시에 자동 처리
  • [User] OnboardingResponsetermsAgreed 필드 추가

트러블 슈팅 ⚽️

약관 동의를 받는 시점 결정

  • 회원가입 직후가 아니라, 프론트가 데이터를 보낼 수 있는 첫 시점인 온보딩 완료 API에서 약관 동의를 처리하기로 결정
    • 최초에는 온보딩 완료 요청에 termsAgreed 필드를 별도로 받아 검증(@AssertTrue)하는 방식으로 설계했으나, 논의 후 별도 체크박스 없이 온보딩 완료 자체가 곧 약관 동의라는 정책으로 확정되어 요청 필드 추가 없이 서버에서 자동으로 처리하도록 단순화

테스트 결과 📄

  • 온보딩 완료 API 호출 후 termsAgreedtrue로 변경되는지 DB 확인

스크린샷 📷

image

리뷰 요구사항 📢

프로덕션 ddl-auto=validate 환경에서의 스키마 반영 누락 발견

  • 코드 리뷰(CodeRabbit)를 통해, 프로덕션 환경은 ddl-auto: validate로 설정되어 있어 엔티티에 컬럼을 추가하는 것만으로는 배포가 불가능하다는 점을 확인
  • validate 모드는 Hibernate가 스키마를 자동 생성하지 않고 엔티티-DB 스키마 일치 여부만 검증하기 때문에, terms_agreed 컬럼이 실제 DB에 먼저 반영되지 않으면 서버 시작 자체가 실패함
  • 이미 존재하는 기존 유저 데이터에 대한 backfill을 위해 DEFAULT FALSE를 지정한 마이그레이션을 별도로 추가 필요:
  ALTER TABLE users ADD COLUMN terms_agreed BOOLEAN NOT NULL DEFAULT FALSE;

-> 참고해주세용

📎 참고 자료 (선택)

Summary by CodeRabbit

  • 새 기능

    • 온보딩 완료 시 약관 동의 상태가 함께 저장됩니다.
    • 약관 동의 여부를 별도로 확인할 수 있습니다.
  • 버그 수정

    • 취침 시간이 기상 시간보다 늦지 않은 경우 올바른 시간 오류가 표시됩니다.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

User에 이용약관 동의 상태를 저장하는 필드를 추가하고, 온보딩 완료 시 동의 상태를 갱신하도록 변경했습니다. 온보딩 시간 검증은 USER_INVALID_TIME 오류 코드를 사용하도록 수정했으며 관련 선언 형식을 정리했습니다.

Changes

온보딩 약관 동의 흐름

Layer / File(s) Summary
약관 동의 상태 저장
src/main/java/com/Timo/Timo/domain/user/entity/User.java
termsAgreed 필드와 terms_agreed 컬럼 매핑을 추가하고, 생성 시 false, 온보딩 완료 시 true로 설정합니다.
온보딩 검증 오류 코드 정리
src/main/java/com/Timo/Timo/domain/user/exception/UserErrorCode.java, src/main/java/com/Timo/Timo/domain/user/service/OnboardingService.java, src/main/java/com/Timo/Timo/domain/user/dto/request/OnboardingRequest.java
시간 검증 예외가 USER_INVALID_TIME을 사용하도록 변경하고 enum 및 요청 레코드 종료 형식을 정리합니다.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: laura-jung, aneykrap

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed User에 termsAgreed가 추가되고 온보딩 완료 시 true로 기록되어 이슈 요구사항과 일치합니다.
Out of Scope Changes check ✅ Passed 변경은 사용자 온보딩과 관련된 엔티티·서비스·에러코드 정리에 한정되어 있습니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 회원가입 시 이용약관 동의 여부를 저장하는 기능 추가라는 변경 목적을 정확히 요약합니다.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch hotfix/#88/signup-terms

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_TIMEINVALID_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

📥 Commits

Reviewing files that changed from the base of the PR and between 57939d9 and 408de2e.

⛔ Files ignored due to path filters (1)
  • src/main/java/com/Timo/Timo/domain/user/docs/OnboardingControllerDocs.java is excluded by !**/docs/**
📒 Files selected for processing (4)
  • src/main/java/com/Timo/Timo/domain/user/dto/request/OnboardingRequest.java
  • src/main/java/com/Timo/Timo/domain/user/entity/User.java
  • src/main/java/com/Timo/Timo/domain/user/exception/UserErrorCode.java
  • src/main/java/com/Timo/Timo/domain/user/service/OnboardingService.java

Comment on lines +77 to +78
@Column(name = "terms_agreed", nullable = false)
private boolean termsAgreed;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ 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 || true

Repository: 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.yml

Repository: Team-Timo/Timo-Server

Length of output: 3268


terms_agreed 컬럼 마이그레이션을 먼저 추가하세요

프로덕션은 ddl-auto: validate라서 이 NOT NULL 컬럼이 DB에 먼저 반영돼 있어야 합니다. 기존 users 행이 있으면 배포가 막힐 수 있으니, terms_agreedfalse로 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 laura-jung left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아주 좋네요 ddl-auto는 update로 수정해두어서 괜찮을 것 같습니다 굳굳

@aneykrap aneykrap left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

빠르게 처리해주셔서 감사합니다.
확인했습니당

@github-actions github-actions Bot added the slack-approval-notified Slack 승인 완료 알림 중복 방지용 라벨 label Jul 10, 2026
@Jy000n Jy000n merged commit b688df0 into develop Jul 10, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🌸 자윤 🚨 hotfix slack-approval-notified Slack 승인 완료 알림 중복 방지용 라벨

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[hotfix] 회원가입 시 이용약관 동의 여부 저장

3 participants