Skip to content

Conversation

@minjee2758
Copy link
Collaborator

@minjee2758 minjee2758 commented Sep 16, 2025

PR 생성 시 아래 항목을 채워주세요.

제목 예시: feat : Pull request template 작성

(작성 후 이 안내 문구는 삭제해주세요)


작업 내용

  • 어떤 기능(또는 수정 사항)을 구현했는지 간략하게 설명해주세요.
  • 예) "회원가입 API에 이메일 중복 검사 기능 추가"

변경 사항

  • 구현한 주요 로직, 클래스, 메서드 등을 bullet 형식으로 기술해주세요.
  • 예)
    • UserService.createUser() 메서드 추가
    • @Email 유효성 검증 적용

트러블 슈팅

  • 구현 중 마주한 문제와 해결 방법을 기술해주세요.
  • 예)
    • 문제: @Transactional이 적용되지 않음
    • 해결: 메서드 호출 방식 변경 (this.AopProxyUtils. 사용)

해결해야 할 문제

  • 기능은 동작하지만 리팩토링이나 논의가 필요한 부분을 적어주세요.
  • 예)D
    • UserController에서 비즈니스 로직 일부 처리 → 서비스로 이전 고려 필요

참고 사항

  • 기타 공유하고 싶은 정보나 참고한 문서(링크 등)가 있다면 작성해주세요.

코드 리뷰 전 확인 체크리스트

  • 불필요한 콘솔 로그, 주석 제거
  • 커밋 메시지 컨벤션 준수 (type : )
  • 기능 정상 동작 확인

Summary by CodeRabbit

  • 신기능

    • 관리자 전용 API 추가: 모든 문제 ID 목록을 반환하는 GET /api/admin/problems/list 엔드포인트가 추가되었습니다. 관리자 권한이 있는 사용자만 접근할 수 있습니다.
  • 기타 작업

    • 쿼리 구성 개선: Querydsl 초기화 방식을 업데이트하여 쿼리 처리의 호환성과 안정성을 향상했습니다.
    • 내부 서비스/저장소 개선: 문제 ID 목록 반환을 위한 내부 지원이 추가되어 관리자 API 응답이 개선되었습니다.

@coderabbitai
Copy link

coderabbitai bot commented Sep 16, 2025

Walkthrough

관리자용 문제 ID 조회 기능이 추가되었다. 컨트롤러에 GET /api/admin/problems/list 엔드포인트가 도입되고, 서비스/도메인 서비스/레포지토리 계층에 List<Long> getProblemIdList() 메서드가 연쇄적으로 추가되었다. Querydsl 설정이 JPQLTemplates.DEFAULT를 사용하도록 변경되었고, 시큐리티 설정은 공백만 수정되었다.

Changes

Cohort / File(s) Summary
Admin API: Problem IDs
src/main/java/org/ezcode/codetest/presentation/problemmanagement/problem/ProblemAdminController.java
관리자 전용 GET /api/admin/problems/list 엔드포인트 추가. ResponseEntity<List<Long>>로 모든 문제 ID 반환. Swagger 주석 및 권한 검사 포함.
Application / Domain Services
src/main/java/org/ezcode/codetest/application/problem/service/ProblemService.java, src/main/java/org/ezcode/codetest/domain/problem/service/ProblemDomainService.java
public List<Long> getProblemIdList() 추가. 하위 계층으로 위임. (ProblemService에 불필요한 ResponseEntity import 추가됨)
Repository API & Impl
src/main/java/org/ezcode/codetest/domain/problem/repository/ProblemRepository.java, src/main/java/org/ezcode/codetest/infrastructure/persistence/repository/problem/ProblemRepositoryImpl.java
레포지토리 인터페이스에 List<Long> getProblemIdList() 추가. 구현은 problemJpaRepository.findAll()Problem::getId로 매핑하여 ID 리스트 반환.
Querydsl Config
src/main/java/org/ezcode/codetest/infrastructure/persistence/config/QuerydslConfig.java
JPAQueryFactory 생성 시 JPQLTemplates.DEFAULT를 명시적으로 사용하도록 변경.
Security Config (cosmetic)
src/main/java/org/ezcode/codetest/common/security/config/SecurityConfig.java
공백(포매팅) 수정만 적용됨 — 동작 변경 없음.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Admin
  participant Controller as ProblemAdminController
  participant AppService as ProblemService
  participant Domain as ProblemDomainService
  participant Repo as ProblemRepository
  participant JPA as ProblemJpaRepository/DB

  Admin->>Controller: GET /api/admin/problems/list
  Note over Controller: @PreAuthorize(ROLE_ADMIN)
  Controller->>AppService: getProblemIdList()
  AppService->>Domain: getProblemIdList()
  Domain->>Repo: getProblemIdList()
  Repo->>JPA: findAll()
  JPA-->>Repo: List<Problem>
  Repo-->>Domain: List<Long> (IDs)
  Domain-->>AppService: List<Long>
  AppService-->>Controller: List<Long>
  Controller-->>Admin: 200 OK + List<Long>
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • NCookies
  • thezz9
  • pokerbearkr
  • chat26666
  • Kimminu7

Poem

깡충깡충, 숫자밭을 뛰어다녀요 🐇
문제들의 번호를 하나둘 모아
바구니에 쏙, 리스트에 쏙—
관리자의 손에 선물처럼 드려요
오늘도 토끼는 데이터 밭에서 춤춰요 🥕✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title Check ⚠️ Warning 제목 "refactor : 유저 문제 풀이 기록 에러 반환 수정"은 PR의 실제 변경사항 요약(문제 ID 목록 반환용 저장소·도메인·서비스 메서드 및 관리자용 엔드포인트 추가, Querydsl 설정 변경 등)과 일치하지 않습니다; 제목은 변경된 주된 기능을 정확히 요약하지 못하므로 검사 기준에 따라 실패로 판단합니다. PR 제목을 변경해 실제 변경 내용을 반영하도록 하세요. 예: "관리자용 문제 ID 목록 조회 API 및 서비스/저장소 메서드 추가" 또는 간단히 "문제 ID 목록 조회 기능 추가"와 같이 구체적이고 간결한 제목으로 수정하거나, 만약 원래 의도대로 '유저 풀이 기록 에러 반환 수정'이 맞다면 코드 변경과 설명을 그 의도에 맞게 수정해 주세요.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/solved-trace

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0ad51b1 and 824bd38.

📒 Files selected for processing (3)
  • src/main/java/org/ezcode/codetest/domain/problem/repository/ProblemRepository.java (2 hunks)
  • src/main/java/org/ezcode/codetest/domain/problem/service/ProblemDomainService.java (1 hunks)
  • src/main/java/org/ezcode/codetest/infrastructure/persistence/repository/problem/ProblemRepositoryImpl.java (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/main/java/org/ezcode/codetest/domain/problem/repository/ProblemRepository.java
  • src/main/java/org/ezcode/codetest/domain/problem/service/ProblemDomainService.java
  • src/main/java/org/ezcode/codetest/infrastructure/persistence/repository/problem/ProblemRepositoryImpl.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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 and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (2)
src/main/java/org/ezcode/codetest/application/problem/service/ProblemService.java (1)

204-206: 읽기 전용 트랜잭션으로 최적화

ID 리스트 조회는 읽기 전용입니다. 아래와 같이 지정하세요.

+    @Transactional(readOnly = true)
     public List<Long> getProblemIdList() {
         return problemDomainService.getProblemIdList();
     }
src/main/java/org/ezcode/codetest/domain/problem/service/ProblemDomainService.java (1)

135-137: 애플리케이션 서비스에 읽기 전용 트랜잭션 적용

  • 파일: src/main/java/org/ezcode/codetest/application/problem/service/ProblemService.java
    메서드: public List getProblemIdList() — @transactional(readOnly = true) 추가하여 불필요한 플러시/락 최소화.
  • 권장(선택): ProblemRepositoryImpl.getProblemIdList()가 problemJpaRepository.findAll()로 엔티티 전체를 로드하므로, 성능·메모리 개선을 위해 「select p.id from Problem p」와 같이 id만 조회하는 전용 쿼리로 변경 고려.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0d8ce27 and 0ad51b1.

📒 Files selected for processing (7)
  • src/main/java/org/ezcode/codetest/application/problem/service/ProblemService.java (2 hunks)
  • src/main/java/org/ezcode/codetest/common/security/config/SecurityConfig.java (0 hunks)
  • src/main/java/org/ezcode/codetest/domain/problem/repository/ProblemRepository.java (2 hunks)
  • src/main/java/org/ezcode/codetest/domain/problem/service/ProblemDomainService.java (2 hunks)
  • src/main/java/org/ezcode/codetest/infrastructure/persistence/config/QuerydslConfig.java (2 hunks)
  • src/main/java/org/ezcode/codetest/infrastructure/persistence/repository/problem/ProblemRepositoryImpl.java (2 hunks)
  • src/main/java/org/ezcode/codetest/presentation/problemmanagement/problem/ProblemAdminController.java (3 hunks)
💤 Files with no reviewable changes (1)
  • src/main/java/org/ezcode/codetest/common/security/config/SecurityConfig.java
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-06-14T14:33:58.372Z
Learnt from: Kimminu7
PR: ezcode-my/backend#63
File: src/main/java/org/ezcode/codetest/infrastructure/persistence/repository/problem/ProblemQueryRepositoryImpl.java:24-40
Timestamp: 2025-06-14T14:33:58.372Z
Learning: ProblemController에서 ProblemSearchCondition 객체는 항상 new ProblemSearchCondition(category, difficulty)로 유효한 인스턴스를 생성해서 전달하므로, ProblemQueryRepositoryImpl의 searchByCondition 메서드에서 searchCondition 파라미터 자체에 대한 null 체크는 불필요하다. category와 difficulty 필드만 각각 null일 수 있다.

Applied to files:

  • src/main/java/org/ezcode/codetest/infrastructure/persistence/repository/problem/ProblemRepositoryImpl.java
📚 Learning: 2025-06-02T06:57:37.929Z
Learnt from: NCookies
PR: ezcode-my/backend#17
File: src/main/java/org/ezcode/codetest/presentation/problemmanagement/ProblemAdminController.java:25-25
Timestamp: 2025-06-02T06:57:37.929Z
Learning: 이 프로젝트에서는 아직 Spring Security가 적용되지 않아서 PreAuthorize 어노테이션이 주석 처리되어 있음. Spring Security 도입 전까지는 권한 검증 어노테이션들이 비활성화 상태임.

Applied to files:

  • src/main/java/org/ezcode/codetest/presentation/problemmanagement/problem/ProblemAdminController.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (2)
src/main/java/org/ezcode/codetest/infrastructure/persistence/repository/problem/ProblemRepositoryImpl.java (1)

57-62: 수정 필요 — Soft delete 반영 및 findAll() 전량 로드 개선 (검증 필요)

파일: src/main/java/org/ezcode/codetest/infrastructure/persistence/repository/problem/ProblemRepositoryImpl.java (57–62)

  • 문제: soft delete 미반영(삭제된 항목 포함) 및 ID만 필요한데 findAll()으로 전체 엔티티 전량 로드.
  • 빠른 수정(즉시 적용 가능):
    @Override
    public List<Long> getProblemIdList() {
-        return problemJpaRepository.findAll().stream()
-            .map(Problem::getId)
-            .toList();
+        return problemJpaRepository.findAll().stream()
+            .filter(p -> !p.isDeleted())
+            .map(Problem::getId)
+            .toList();
    }
  • 권장 수정(효율적, DB에서 ID만 조회):
    추가:
@Query("select p.id from Problem p where p.isDeleted = false")
List<Long> findAllActiveIds();

교체:

-    return problemJpaRepository.findAll().stream()
-        .filter(p -> !p.isDeleted())
-        .map(Problem::getId)
-        .toList();
+    return problemJpaRepository.findAllActiveIds();

검증 필요: 제공된 스크립트 실행 결과 "No files were searched"로 파일 검색이 실패했습니다. 리포지토리 루트에서 아래 명령을 실행해 확인하세요:

# .toList 사용 검사
git grep -n '\.toList(' || rg -n --hidden '\.toList\(\)'

# 빌드 설정(프로젝트 Java 버전) 확인
git grep -n 'sourceCompatibility\|maven.compiler.source\|java.version' || true

# 런타임 자바 버전 확인
java -version
src/main/java/org/ezcode/codetest/infrastructure/persistence/config/QuerydslConfig.java (1)

6-16: 정정: JPAQueryFactory(JPQLTemplates.DEFAULT, EntityManager) 생성자 사용은 유효 — 변경 불필요

JPAQueryFactory는 JPQLTemplates와 EntityManager를 받는 생성자를 제공합니다(예: Querydsl 4.x/5.x). (querydsl.com)
제안된 new Configuration(...) 대체는 잘못된 타입/네임스페이스 사용으로 오류를 유발하므로 적용하지 마십시오.

Likely an incorrect or invalid review comment.

import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

애플리케이션 서비스에 불필요한 ResponseEntity import

컨트롤러 전용 타입이므로 import 를 제거하세요.

-import org.springframework.http.ResponseEntity;
📝 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
import org.springframework.http.ResponseEntity;
🤖 Prompt for AI Agents
In
src/main/java/org/ezcode/codetest/application/problem/service/ProblemService.java
around line 29, remove the unnecessary import of
org.springframework.http.ResponseEntity (it's a controller-only type); delete
that import line and run import organization (or IDE optimize imports) to ensure
no unused imports remain and the file compiles cleanly.

import org.ezcode.codetest.domain.problem.model.entity.Problem;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

도메인 계층에 web 의존 침투(ResponseEntity import 제거 필요)

Repository 인터페이스가 org.springframework.http.ResponseEntity를 import 하고 있습니다. 계층 경계 위반입니다. 제거하세요.

적용 diff:

-import org.springframework.http.ResponseEntity;
📝 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
import org.springframework.http.ResponseEntity;
🤖 Prompt for AI Agents
In
src/main/java/org/ezcode/codetest/domain/problem/repository/ProblemRepository.java
around line 10, the repository interface improperly imports
org.springframework.http.ResponseEntity (web layer type) which violates domain
layer boundaries; remove that import and change any method signatures or return
types that reference ResponseEntity to appropriate domain-layer types (e.g., the
entity type, Optional<Entity>, List<Entity>, boolean, or a custom domain DTO)
and update callers in the application/service layer to wrap results in
ResponseEntity there instead.


void problemCountAdjustment(Long problemId, int correctInc);

List<Long> getProblemIdList();
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

메서드 계약 모호/부적절: 소프트 삭제 데이터 포함 가능성

프로젝트 전반이 soft delete(isDeleted=false)를 전제로 동작합니다. getProblemIdList()는 삭제된 문제를 배제해야 합니다. 구현/자바독에 명확히 하거나 메서드명을 getActiveProblemIdList로 조정하세요.

🤖 Prompt for AI Agents
In
src/main/java/org/ezcode/codetest/domain/problem/repository/ProblemRepository.java
around line 29, the method signature List<Long> getProblemIdList() is ambiguous
about soft-deleted rows; update the contract to exclude deleted problems by
either (a) renaming the method to getActiveProblemIdList() and updating its
Javadoc to state it returns only problems with isDeleted = false, or (b) keep
the name but add an explicit implementation/query that filters WHERE is_deleted
= false and add Javadoc clarifying the behavior; ensure callers/tests are
updated to use the new name/semantics.

import org.ezcode.codetest.domain.problem.repository.ProblemRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

도메인 서비스에 web 의존 침투(ResponseEntity import 제거 필요)

ResponseEntity import는 불필요하며 계층 침범입니다. 제거하세요.

-import org.springframework.http.ResponseEntity;
📝 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
import org.springframework.http.ResponseEntity;
🤖 Prompt for AI Agents
In
src/main/java/org/ezcode/codetest/domain/problem/service/ProblemDomainService.java
around line 21, remove the unnecessary web-layer import
"org.springframework.http.ResponseEntity" and eliminate any usage of
ResponseEntity in this domain service; replace method signatures and return
types with domain-specific types or DTOs (or plain domain objects) and convert
any ResponseEntity-based returns to return those types (or throw domain
exceptions) so the domain layer has no dependency on Spring Web classes.

@minjee2758 minjee2758 merged commit 2207eb5 into dev Sep 17, 2025
2 checks passed
@minjee2758 minjee2758 deleted the refactor/solved-trace branch September 17, 2025 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants