Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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 @@ -29,12 +29,12 @@ public record ProblemCreateRequest(
Difficulty difficulty,

@NotNull(message = "메모리 제한을 설정해야 합니다.")
@Schema(description = "메모리 제한", example = "30000")
@Schema(description = "메모리 제한(KB)", example = "30000")
Long memoryLimit,

@NotNull(message = "시간 제한을 설정해야 합니다.")
@Schema(description = "시간 제한", example = "1000.0")
Double timeLimit,
@Schema(description = "시간 제한(ms)", example = "1000")
Long timeLimit,

@NotNull(message = "출처를 명시해야 합니다.")
@Schema(description = "출처", example = "ORIGINAL")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ public record ProblemUpdateRequest(
@Schema(description = "난이도", example = "BRONZE")
Difficulty difficulty,

@Schema(description = "메모리 제한", example = "30000")
@Schema(description = "메모리 제한(KB)", example = "30000")
Long memoryLimit,

@Schema(description = "시간 제한", example = "1000.0")
Double timeLimit,
@Schema(description = "시간 제한(ms)", example = "1000")
Long timeLimit,

@Schema(description = "출처", example = "ORIGINAL")
Reference reference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ public record ProblemDetailResponse(
@Schema(description = "난이도", example = "BRONZE")
String difficulty,

@Schema(description = "메모리 제한", example = "30000")
@Schema(description = "메모리 제한(KB)", example = "30000")
Long memoryLimit,

@Schema(description = "시간 제한", example = "1000.0")
Double timeLimit,
@Schema(description = "시간 제한(ms)", example = "1000")
Long timeLimit,

@Schema(description = "출처", example = "ORIGINAL")
Reference reference,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class Problem extends BaseEntity {
private Long memoryLimit;

@Column(nullable = false)
private Double timeLimit;
private Long timeLimit;

@Enumerated(EnumType.STRING)
@Column(nullable = false)
Expand All @@ -72,7 +72,7 @@ public class Problem extends BaseEntity {

@Builder
public Problem(User creator, Category category, String title, String description, int score, String difficulty,
Long memoryLimit, Double timeLimit, Reference reference) {
Long memoryLimit, Long timeLimit, Reference reference) {
this.creator = creator;
this.category = category;
this.title = title;
Expand All @@ -87,7 +87,7 @@ public Problem(User creator, Category category, String title, String description

// 여러개를 하나의 객체로 만드는 것
public static Problem of(User creator, Category category, String title, String description, int score, String difficulty,
Long memoryLimit, Double timeLimit, Reference reference) {
Long memoryLimit, Long timeLimit, Reference reference) {

return Problem.builder()
.creator(creator)
Expand All @@ -104,7 +104,7 @@ public static Problem of(User creator, Category category, String title, String d

// 문제 수정 로직
public void update(User creator, Category category, String title, String description, Difficulty difficulty,
Long memoryLimit, Double timeLimit, Reference reference) {
Long memoryLimit, Long timeLimit, Reference reference) {

if (creator != null) this.creator = creator;
if (category != null) this.category = category;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@

@Getter
public enum Difficulty {
BRONZE("브론즈", 20),
SILVER("실버", 40),
GOLD("골드", 60),
PLATINUM("플래티넘", 80),
DIAMOND("다이아", 100);
LV1("1", 10),
LV2("2", 20),
LV3("3", 40),
LV4("4", 80),
LV5("5", 160),
LV6("6", 320),
LV7("7",640);
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

🧩 Verification correct

난이도 체계의 대규모 변경이 감지되었습니다.

기존 BRONZEDIAMOND 체계에서 LV1LV7로의 완전한 변경과 점수 체계의 기하급수적 증가 패턴 적용은 좋은 개선입니다. 하지만 이는 기존 데이터와의 호환성 문제를 야기할 수 있는 breaking change입니다.

다음 사항들을 확인해주세요:

  1. 기존 데이터베이스의 difficulty 값들과의 호환성
  2. 데이터 마이그레이션 계획
  3. API 버전 관리 전략

🏁 Script executed:

#!/bin/bash
# 기존 difficulty 값 사용처 확인
rg -A 3 "BRONZE|SILVER|GOLD|PLATINUM|DIAMOND"

# Problem 테이블의 difficulty 컬럼 데이터 타입 확인
ast-grep --pattern 'difficulty'

Length of output: 9473


난이도 체계의 대규모 변경이 감지되었습니다.

기존 BRONZEDIAMOND 체계에서 LV1LV7로의 완전한 변경과 점수 체계의 기하급수적 증가 패턴 적용은 좋은 개선입니다. 하지만 이는 기존 데이터와의 호환성 문제를 야기할 수 있는 breaking change입니다.

다음 사항들을 확인해주세요:

  1. 기존 데이터베이스의 difficulty 값들과의 호환성
  2. 데이터 마이그레이션 계획
  3. API 버전 관리 전략
#!/bin/bash
# 기존 difficulty 값 사용처 확인
rg -A 3 "BRONZE|SILVER|GOLD|PLATINUM|DIAMOND"

# Problem 테이블의 difficulty 컬럼 데이터 타입 확인
ast-grep --pattern 'difficulty'
🤖 Prompt for AI Agents
In src/main/java/org/ezcode/codetest/domain/problem/model/enums/Difficulty.java
around lines 12 to 18, the enum values have been changed from BRONZE~DIAMOND to
LV1~LV7 with a new exponential scoring system, which is a breaking change. To
fix this, verify compatibility with existing database difficulty values, plan
and implement necessary data migration scripts to convert old values to the new
scheme, and establish an API versioning strategy to support both old and new
difficulty formats during transition. Also, run the suggested shell commands to
audit current usage and data types before proceeding.


private final String difficulty;

Expand Down