Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-data-jpa")

// mysql
runtimeOnly("mysql:mysql-connector-java:8.0.33")
runtimeOnly("com.mysql:mysql-connector-j")

// h2
runtimeOnly("com.h2database:h2")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,13 @@ class Member(
@Column(name = "fcm_token", nullable = false)
var fcmToken: String = "",

@Column(name = "terms_agreed", nullable = false)
var isTermsAgreed: Boolean = false,
Comment on lines +53 to +54
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

데이터베이스 마이그레이션 스크립트를 확인해주세요.

새로운 non-nullable 필드가 추가되었으므로 기존 데이터에 대한 마이그레이션이 필요합니다.

다음 스크립트로 마이그레이션 파일이 있는지 확인해보겠습니다:


🏁 Script executed:

#!/bin/bash
# Description: 데이터베이스 마이그레이션 파일 확인
# Expected: terms_agreed 컬럼 추가에 대한 마이그레이션 파일 존재

# Flyway 마이그레이션 파일 검색
fd -e sql . | xargs grep -l "terms_agreed\|isTermsAgreed" || echo "마이그레이션 파일을 찾을 수 없습니다"

# Liquibase 마이그레이션 파일 검색
fd -e xml -e yml -e yaml . | xargs grep -l "terms_agreed\|isTermsAgreed" || echo "Liquibase 마이그레이션 파일을 찾을 수 없습니다"

Length of output: 256


데이터베이스 마이그레이션 스크립트 추가 필요

새로 추가된 non-nullable 필드(isTermsAgreed: Boolean = false)에 대한 마이그레이션 파일이 현재 확인되지 않습니다. 기존 테이블에 해당 컬럼을 추가하고 기본값을 설정하려면 아래 사항을 반영해주세요.

• 대상 코드

  • 파일: src/main/kotlin/gomushin/backend/member/domain/entity/Member.kt
  • 위치: 53–54라인 (@Column(name = "terms_agreed", nullable = false) var isTermsAgreed: Boolean = false)

• 추가할 마이그레이션 예시 (Flyway SQL)

-- V20250801__add_terms_agreed.sql
ALTER TABLE member
  ADD COLUMN terms_agreed BOOLEAN NOT NULL DEFAULT FALSE;

• Liquibase 사용 시 예시 (XML)

<changeSet id="20250801-add-terms-agreed" author="yourname">
  <addColumn tableName="member">
    <column name="terms_agreed" type="BOOLEAN" defaultValueBoolean="false" />
  </addColumn>
</changeSet>

위와 같이 Flyway 또는 Liquibase 마이그레이션 파일을 작성·등록하여 기존 데이터가 false로 설정되도록 처리해주세요.

🤖 Prompt for AI Agents
In src/main/kotlin/gomushin/backend/member/domain/entity/Member.kt at lines
53-54, you added a new non-nullable Boolean field isTermsAgreed with a default
value false, but there is no corresponding database migration script. To fix
this, create and register a migration file (using Flyway or Liquibase) that adds
the terms_agreed column to the member table with NOT NULL and DEFAULT FALSE,
ensuring existing records get the default value without errors.


) : BaseEntity() {
companion object {
private const val EMPTY_STATUS_MESSAGE = ""

fun create(
name: String,
nickname: String?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class OnboardingService(
member.birthDate = onboardingRequest.birthDate
member.role = Role.MEMBER
member.fcmToken = onboardingRequest.fcmToken
member.isTermsAgreed = onboardingRequest.isTermsAgreed
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

약관 동의 필수 검증 로직 추가를 고려해보세요.

약관 동의는 중요한 비즈니스 로직이므로, 단순한 할당보다는 검증 로직을 추가하는 것이 좋겠습니다.

다음과 같은 검증 로직을 고려해보세요:

-        member.isTermsAgreed = onboardingRequest.isTermsAgreed
+        if (!onboardingRequest.isTermsAgreed) {
+            throw BadRequestException("sarangggun.member.terms-agreement-required")
+        }
+        member.isTermsAgreed = onboardingRequest.isTermsAgreed
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
member.isTermsAgreed = onboardingRequest.isTermsAgreed
if (!onboardingRequest.isTermsAgreed) {
throw BadRequestException("sarangggun.member.terms-agreement-required")
}
member.isTermsAgreed = onboardingRequest.isTermsAgreed
🤖 Prompt for AI Agents
In src/main/kotlin/gomushin/backend/member/domain/service/OnboardingService.kt
at line 23, the code directly assigns the terms agreement status without
validation. Add a validation step before assignment to ensure that the user has
agreed to the terms, and if not, throw an appropriate exception or handle the
error to enforce mandatory agreement.

}

@Transactional(readOnly = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ data class OnboardingRequest(

@Schema(description = "알림 설정 여부", example = "false")
val isNotification: Boolean,

@Schema(description = "약관 동의 여부", example = "true")
val isTermsAgreed: Boolean
Comment on lines +19 to +20
Copy link

@coderabbitai coderabbitai bot Aug 2, 2025

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

약관 동의 필드에 validation 추가를 고려해보세요.

약관 동의는 필수 항목일 가능성이 높으므로 validation을 추가하는 것이 좋겠습니다.

다음과 같은 validation을 고려해보세요:

+import jakarta.validation.constraints.AssertTrue
+
 @Schema(description = "약관 동의 여부", example = "true")
+@AssertTrue(message = "약관에 동의해야 합니다")
 val isTermsAgreed: Boolean

또는 커스텀 validation을 사용할 수도 있습니다:

+@ValidTermsAgreement
 val isTermsAgreed: Boolean
🤖 Prompt for AI Agents
In src/main/kotlin/gomushin/backend/member/dto/request/OnboardingRequest.kt at
lines 19-20, the isTermsAgreed Boolean field lacks validation to ensure it is
true, which is important since agreeing to terms is likely mandatory. Add a
validation annotation such as @AssertTrue to this field to enforce that the user
must agree to the terms. If needed, implement a custom validator to provide more
specific validation logic or error messages.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

validation은 프론트엔드에서 처리할거야.

Copy link

Choose a reason for hiding this comment

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

@HoyeongJeon 알겠습니다! 프론트엔드에서 validation을 처리하시는 방향으로 진행하시는군요. 현재 구현된 코드 그대로 두시면 됩니다.

(´•̥̥̥ω•̥̥̥`)


✏️ Learnings added
Learnt from: HoyeongJeon
PR: Gomushim/backend#167
File: src/main/kotlin/gomushin/backend/member/dto/request/OnboardingRequest.kt:19-20
Timestamp: 2025-08-02T07:38:57.362Z
Learning: In the Gomushim backend project, validation for terms agreement (isTermsAgreed) is handled on the frontend rather than adding server-side validation annotations to the OnboardingRequest DTO.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

)