Skip to content
Merged
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 @@ -32,8 +32,13 @@ public record ProblemResponse(
Difficulty difficulty,

@Schema(description = "출처", example = "ORIGINAL")
Reference reference
Reference reference,

@Schema(description = "총 제출횟수", example = "0")
Long totalSubmissions,

@Schema(description = "성공한 횟수", example = "0")
Long correctSubmissions
) {

public static ProblemResponse from(Problem problem, List<Category> categories) {
Expand All @@ -50,6 +55,8 @@ public static ProblemResponse from(Problem problem, List<Category> categories) {
.score(problem.getScore())
.difficulty(problem.getDifficulty())
.reference(problem.getReference())
.totalSubmissions(problem.getTotalSubmissions())
.correctSubmissions(problem.getCorrectSubmissions())
Comment on lines +58 to +59
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

팩토리 메서드 구현이 적절하나 검증이 필요합니다.

필드 설정이 기존 패턴과 일관되게 구현되었습니다. 다음 사항들을 확인해 주세요:

  • Problem 엔티티에 getTotalSubmissions()getCorrectSubmissions() 메서드가 존재하는지 확인
  • 이 메서드들이 null을 반환할 가능성이 있는지 확인

다음 스크립트를 실행하여 Problem 엔티티의 메서드 존재 여부를 확인해 주세요:


🏁 Script executed:

#!/bin/bash
# Description: Problem 엔티티에서 getTotalSubmissions와 getCorrectSubmissions 메서드 존재 여부 확인

# Problem 엔티티 파일에서 해당 메서드들 검색
ast-grep --pattern 'getTotalSubmissions() {
  $$$
}'

ast-grep --pattern 'getCorrectSubmissions() {
  $$$
}'

# 또는 메서드 시그니처 검색
rg -A 3 "getTotalSubmissions|getCorrectSubmissions" --type java

Length of output: 743


다음 스크립트를 실행하여 Problem 엔티티 클래스의 존재 여부와 totalSubmissions/correctSubmissions 필드 타입 및 Lombok 어노테이션 유무를 확인해 주세요:


🏁 Script executed:

#!/bin/bash
# 1. Problem 엔티티 클래스 파일 경로 및 선언부 확인
rg -n "class Problem" --type java

# 2. 클래스 선언부 주변(어노테이션 포함) 상세 확인
rg -A5 "class Problem" --type java

# 3. totalSubmissions 및 correctSubmissions 필드 정의 확인
rg -n "totalSubmissions" --type java
rg -n "correctSubmissions" --type java

# 4. Lombok @Getter/@Data 등 어노테이션 확인
rg -n "@Getter\|@Data\|@Value" --type java | rg "Problem"

Length of output: 19132


Problem 엔티티에 Getter 미구현 및 null 처리 보완 필요

  • Problem 도메인 엔티티에 getTotalSubmissions() / getCorrectSubmissions() 메서드 정의가 없어 컴파일 에러 발생
  • Long 타입 필드(totalSubmissions, correctSubmissions)에 대한 null 반환 가능성 검토 및 기본값 처리 필요

해결 방안:

  • Problem 클래스에 해당 getter 메서드를 직접 추가하거나 Lombok @Getter 어노테이션 적용
  • DTO 팩토리 메서드 호출부(ProblemResponse.from)에서 null 대비 기본값 처리 (예: Objects.requireNonNullElse(...) 등)

대상 파일:

  • src/main/java/org/ezcode/codetest/domain/problem/model/entity/Problem.java
  • src/main/java/org/ezcode/codetest/application/problem/dto/response/ProblemResponse.java (58–59)
🤖 Prompt for AI Agents
In src/main/java/org/ezcode/codetest/domain/problem/model/entity/Problem.java,
add getter methods for totalSubmissions and correctSubmissions fields or apply
Lombok @Getter annotation to enable access. In
src/main/java/org/ezcode/codetest/application/problem/dto/response/ProblemResponse.java
at lines 58-59, update the calls to problem.getTotalSubmissions() and
problem.getCorrectSubmissions() to handle possible null values by using
Objects.requireNonNullElse or a similar approach to provide default values,
preventing potential NullPointerExceptions.

.build();
}
}