Skip to content

Conversation

@chat26666
Copy link
Collaborator

@chat26666 chat26666 commented Jun 25, 2025


작업 내용

  • 문제 해결시 게임 캐릭터 성장이 되게끔 연동기능이 추가되었습니다.

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

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

Summary by CodeRabbit

  • 신규 기능
    • 문제 제출 결과를 요약하는 새로운 결과 객체가 추가되었습니다.
    • 사용자 문제 결과에서 문제 카테고리 설명을 조회하는 기능이 추가되었습니다.
  • 버그 수정
    • 문제 풀이 이벤트가 중복으로 발생하지 않도록 개선되었습니다.
  • 리팩터
    • 여러 서비스 및 이벤트 관련 메서드의 파라미터와 반환 타입이 새로운 결과 객체로 변경되었습니다.
    • 일부 이벤트 필드명이 더 명확하게 변경되었습니다.
    • 이벤트 리스너의 어노테이션이 단순화되었습니다.

@chat26666 chat26666 self-assigned this Jun 25, 2025
@chat26666 chat26666 added the enhancement New feature or request label Jun 25, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jun 25, 2025

"""

Walkthrough

이번 변경 사항에서는 문제 풀이 이벤트 처리 과정에서 사용되는 데이터 모델을 UserProblemResult에서 SubmissionResult로 대체하였고, 관련 메서드 시그니처 및 내부 로직을 이에 맞게 수정했습니다. 또한, 이벤트 중복 발행 방지 로직이 추가되고, 일부 이벤트 필드 및 리스너 어노테이션이 변경되었습니다.

Changes

파일/경로 변경 요약
.../application/submission/port/ProblemEventService.java
.../infrastructure/event/publisher/ProblemEventPublisher.java
publishProblemSolveEvent 메서드의 파라미터 타입을 UserProblemResult에서 SubmissionResult로 변경, 시그니처 및 내부 로직 수정
.../application/submission/service/SubmissionService.java
.../domain/submission/service/SubmissionDomainService.java
finalizeSubmission 반환 타입을 UserProblemResult에서 SubmissionResult로 변경, 관련 변수명 및 호출부 수정
.../domain/submission/model/SubmissionResult.java SubmissionResult 레코드 신설, 필드 및 정적 팩토리 메서드 추가
.../domain/submission/model/entity/UserProblemResult.java getProblemCategoryDescription() 메서드 추가
.../infrastructure/event/dto/GameLevelUpEvent.java 필드명 isProblemSolvedisSolved로 변경
.../infrastructure/event/listener/GameLevelUpListener.java 이벤트 리스너 어노테이션을 @TransactionalEventListener에서 @EventListener로 변경, 필드명 반영 및 불필요 import 제거

Sequence Diagram(s)

sequenceDiagram
    participant SubmissionService
    participant SubmissionDomainService
    participant ProblemEventPublisher
    participant GameLevelUpListener

    SubmissionService->>SubmissionDomainService: finalizeSubmission(submissionData, aggregator, passedCount)
    SubmissionDomainService-->>SubmissionService: SubmissionResult
    SubmissionService->>ProblemEventPublisher: publishProblemSolveEvent(SubmissionResult)
    alt hasBeenSolved == false
        ProblemEventPublisher->>GameLevelUpListener: GameLevelUpEvent(userId, problemCategory, isSolved)
        GameLevelUpListener->>GameLevelUpListener: handleGameCharacterLevelUp(event)
    else hasBeenSolved == true
        ProblemEventPublisher-->>SubmissionService: (이벤트 발행 생략)
    end
Loading

Suggested reviewers

  • NCookies
  • minjee2758
  • pokerbearkr

Poem

🐇
새로운 결과로 깔끔하게,
중복 이벤트는 이제 안녕!
필드와 타입이 바뀌었네,
레코드로 담은 네 마음,
레벨업 이벤트도 더 똑똑하게,
코드를 타고 흐르는 변화의 바람,
오늘도 토끼는 춤을 춰요!

"""


📜 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 86092af and 5023656.

📒 Files selected for processing (2)
  • src/main/java/org/ezcode/codetest/domain/submission/model/SubmissionResult.java (1 hunks)
  • src/main/java/org/ezcode/codetest/domain/submission/model/entity/UserProblemResult.java (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/main/java/org/ezcode/codetest/domain/submission/model/entity/UserProblemResult.java
  • src/main/java/org/ezcode/codetest/domain/submission/model/SubmissionResult.java
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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: 0

🧹 Nitpick comments (1)
src/main/java/org/ezcode/codetest/domain/submission/service/SubmissionDomainService.java (1)

49-51: boolean 매개변수의 의미 명확화 필요

SubmissionResult.from(result, false)SubmissionResult.from(result, true)에서 두 번째 매개변수의 의미가 명확하지 않습니다.

코드를 분석해보면 false는 "새로 해결됨"을, true는 "이미 해결되었음"을 의미하는 것 같은데, 매개변수명이나 상수를 사용하여 의미를 명확히 하는 것을 권장합니다.

다음과 같이 개선할 수 있습니다:

-                        return SubmissionResult.from(result, false);
+                        return SubmissionResult.from(result, /* isAlreadySolved */ false);
-                    return SubmissionResult.from(result, true);
+                    return SubmissionResult.from(result, /* isAlreadySolved */ true);

또는 SubmissionResult에 명명된 정적 메서드를 추가하는 것도 고려해볼 수 있습니다.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2ce16d7 and 3999f13.

📒 Files selected for processing (7)
  • src/main/java/org/ezcode/codetest/application/submission/port/ProblemEventService.java (1 hunks)
  • src/main/java/org/ezcode/codetest/application/submission/service/SubmissionService.java (2 hunks)
  • src/main/java/org/ezcode/codetest/domain/submission/model/SubmissionResult.java (1 hunks)
  • src/main/java/org/ezcode/codetest/domain/submission/service/SubmissionDomainService.java (3 hunks)
  • src/main/java/org/ezcode/codetest/infrastructure/event/dto/GameLevelUpEvent.java (1 hunks)
  • src/main/java/org/ezcode/codetest/infrastructure/event/listener/GameLevelUpListener.java (2 hunks)
  • src/main/java/org/ezcode/codetest/infrastructure/event/publisher/ProblemEventPublisher.java (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
🔇 Additional comments (14)
src/main/java/org/ezcode/codetest/infrastructure/event/dto/GameLevelUpEvent.java (1)

7-7: 필드명 변경이 일관성을 위해 적절합니다.

isProblemSolved에서 isSolved로 변경된 것은 다른 클래스들과의 일관성을 위한 좋은 변경입니다.

모든 참조가 업데이트되었는지 확인하기 위해 다음 스크립트를 실행해보겠습니다:

#!/bin/bash
# 기존 필드명 사용 여부 확인
rg "isProblemSolved" --type java -A 2 -B 2
src/main/java/org/ezcode/codetest/application/submission/service/SubmissionService.java (2)

31-31: import 변경이 적절합니다.

UserProblemResult에서 SubmissionResult로의 import 변경이 리팩토링 목적에 맞게 잘 적용되었습니다.


128-132: 변수 타입 및 메서드 호출 변경이 일관성 있게 적용되었습니다.

SubmissionResult 타입으로의 변경과 해당 변수를 사용한 이벤트 발행 로직이 일관성 있게 잘 구현되었습니다.

src/main/java/org/ezcode/codetest/application/submission/port/ProblemEventService.java (2)

3-3: import 변경이 올바릅니다.

새로운 SubmissionResult 모델을 사용하기 위한 적절한 import 변경입니다.


7-7: 인터페이스 메서드 시그니처 변경이 적절합니다.

UserProblemResult에서 SubmissionResult로의 파라미터 타입 변경이 리팩토링 목적에 맞게 잘 적용되었습니다.

src/main/java/org/ezcode/codetest/domain/submission/model/SubmissionResult.java (2)

7-18: 새로운 SubmissionResult 레코드가 잘 설계되었습니다.

레코드 설계가 훌륭합니다:

  • 필요한 필드들이 명확하게 정의됨
  • hasBeenSolved 필드 추가로 중복 이벤트 방지 가능
  • @Builder 어노테이션으로 유연한 인스턴스 생성 지원

19-26: 정적 팩토리 메서드가 올바르게 구현되었습니다.

UserProblemResult에서 SubmissionResult로의 변환 로직이 정확합니다:

  • 사용자 ID, 문제 카테고리, 해결 여부가 올바르게 매핑됨
  • hasBeenSolved 파라미터를 통해 중복 방지 로직 지원
src/main/java/org/ezcode/codetest/infrastructure/event/publisher/ProblemEventPublisher.java (3)

17-17: 메서드 시그니처 변경이 적절합니다.

SubmissionResult 파라미터로의 변경이 인터페이스와 일치하며 올바르게 구현되었습니다.


19-19: 중복 이벤트 방지 로직이 훌륭한 개선사항입니다.

hasBeenSolved() 체크를 통해 이미 해결된 문제에 대한 중복 이벤트 발행을 방지하는 것은 시스템 효율성과 정확성을 위한 우수한 구현입니다.


21-25: 필드 접근 방식이 새로운 모델에 맞게 올바르게 업데이트되었습니다.

SubmissionResult의 accessor 메서드들(userId(), problemCategory(), isSolved())을 사용하여 데이터를 추출하고 GameLevelUpEvent를 생성하는 로직이 정확합니다.

src/main/java/org/ezcode/codetest/infrastructure/event/listener/GameLevelUpListener.java (2)

22-22: 이벤트 리스너 어노테이션 변경에 대한 의도 확인 필요

@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT)에서 @EventListener로 변경되었습니다. 이는 이벤트 처리 타이밍을 트랜잭션 커밋 후에서 즉시 처리로 변경하는 것입니다. 이 변경이 의도된 것인지 확인해 주세요.

기존 설계에서는 문제 제출 트랜잭션이 성공적으로 커밋된 후에 레벨업 이벤트를 처리했는데, 이제는 트랜잭션 진행 중에 처리하게 됩니다.


27-28: 이벤트 필드명 변경 승인

event.isProblemSolved()에서 event.isSolved()로 메서드명이 변경되었습니다. 새로운 이벤트 구조에 맞춘 적절한 변경으로 보입니다.

src/main/java/org/ezcode/codetest/domain/submission/service/SubmissionDomainService.java (2)

32-32: 반환 타입 변경 승인

UserProblemResult에서 SubmissionResult로 반환 타입을 변경한 것은 도메인 서비스의 추상화를 개선하는 좋은 변경입니다. 내부 엔티티보다는 도메인 결과 객체를 반환하는 것이 더 적절합니다.


53-60: 다음 스크립트로 from 메서드 내부 로직을 확인해 주세요.

#!/bin/bash
file=src/main/java/org/ezcode/codetest/domain/submission/model/SubmissionResult.java

# from 메서드 구현 상세(앞뒤 10줄) 확인
rg --color=never -n -B 10 -A 10 "public static SubmissionResult from" "$file"

@chat26666 chat26666 merged commit 9e591ad into dev Jun 25, 2025
2 checks passed
@chat26666 chat26666 deleted the feature/submission branch June 25, 2025 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants