-
Notifications
You must be signed in to change notification settings - Fork 3
feat : 문제 해결시 캐릭터 레벨업 기능 추가 #100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
""" Walkthrough이번 변경 사항에서는 문제 풀이 이벤트 처리 과정에서 사용되는 데이터 모델을 Changes
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
Suggested reviewers
Poem
""" 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms (1)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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
📒 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 2src/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"
작업 내용
코드 리뷰 전 확인 체크리스트
type :)Summary by CodeRabbit