Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ public interface OnboardingControllerDocs {

@Operation(
summary = "온보딩 완료",
description = "언어, 예측 정확도, 기상/취침 시간을 저장하고 온보딩을 완료 처리합니다.")
description = """
언어, 예측 정확도, 기상/취침 시간을 저장하고 온보딩을 완료 처리합니다.
온보딩 완료 시 이용약관에 동의한 것으로 함께 처리됩니다.
""")
@ApiResponses({
@ApiResponse(
responseCode = "200",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,4 @@ public record OnboardingRequest(
@NotNull(message = "bedTime은 필수입니다.")
@Pattern(regexp = "^([01]\\d|2[0-3]):[0-5]\\d$", message = "bedTime 형식은 HH:MM 이어야 합니다.")
String bedTime
){
}
){}
5 changes: 5 additions & 0 deletions src/main/java/com/Timo/Timo/domain/user/entity/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ public class User extends BaseTimeEntity {
@Column(name = "calendar_email")
private String calendarEmail;

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

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


public void update(String name, String profileImageUrl) {
this.name = name;
this.profileImageUrl = profileImageUrl;
Expand All @@ -89,6 +92,7 @@ public void completeOnboarding(
this.predictionAccuracy = predictionAccuracy;
this.wakeUpTime = wakeUpTime;
this.bedTime = bedTime;
this.termsAgreed = true;
this.onboardingCompleted = true;
}

Expand Down Expand Up @@ -123,5 +127,6 @@ private User(

this.calendarConnected = false;
this.calendarEmail = null;
this.termsAgreed = false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
@RequiredArgsConstructor
public enum UserErrorCode implements BaseErrorCode {

USER_400_INVALID_TIME(HttpStatus.BAD_REQUEST, "USER_400", "취침 시간은 기상 시간보다 이후여야 합니다."),
USER_INVALID_TIME(HttpStatus.BAD_REQUEST, "USER_400", "취침 시간은 기상 시간보다 이후여야 합니다."),
INVALID_TIMEZONE(HttpStatus.BAD_REQUEST, "USER_400", "유효하지 않은 시간대 ID입니다."),
USER_NOT_FOUND(HttpStatus.NOT_FOUND, "USER_404", "존재하지 않는 사용자입니다.");
USER_NOT_FOUND(HttpStatus.NOT_FOUND, "USER_404", "존재하지 않는 사용자입니다."),
;

private final HttpStatus httpStatus;
private final String code;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public OnboardingResponse completeOnboarding(Long userId, OnboardingRequest requ
LocalTime bedTime = LocalTime.parse(request.bedTime());

if (!bedTime.isAfter(wakeUpTime)) {
throw new CustomException(UserErrorCode.USER_400_INVALID_TIME);
throw new CustomException(UserErrorCode.USER_INVALID_TIME);
}

user.completeOnboarding(
Expand Down