-
Notifications
You must be signed in to change notification settings - Fork 3
refactor : api 경로 변경 및 필요없는 코드 정리 #97
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/main/java/org/ezcode/codetest/infrastructure/event/dto/GameLevelUpEvent.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| package org.ezcode.codetest.infrastructure.event.dto; | ||
|
|
||
| public record GameLevelUpEvent( | ||
|
|
||
| Long userId, | ||
|
|
||
| boolean isProblemSolved, | ||
|
|
||
| String problemCategory | ||
|
|
||
| ) { | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/main/java/org/ezcode/codetest/infrastructure/event/listener/GameLevelUpListener.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| package org.ezcode.codetest.infrastructure.event.listener; | ||
|
|
||
| import org.ezcode.codetest.domain.game.exception.GameException; | ||
| import org.ezcode.codetest.domain.game.service.CharacterStatusDomainService; | ||
| import org.ezcode.codetest.infrastructure.event.dto.GameLevelUpEvent; | ||
| import org.springframework.stereotype.Component; | ||
| import org.springframework.transaction.annotation.Propagation; | ||
| import org.springframework.transaction.annotation.Transactional; | ||
| import org.springframework.transaction.event.TransactionPhase; | ||
| import org.springframework.transaction.event.TransactionalEventListener; | ||
| import org.springframework.transaction.interceptor.TransactionAspectSupport; | ||
|
|
||
| import lombok.RequiredArgsConstructor; | ||
| import lombok.extern.slf4j.Slf4j; | ||
|
|
||
| @Slf4j | ||
| @Component | ||
| @RequiredArgsConstructor | ||
| public class GameLevelUpListener { | ||
|
|
||
| private final CharacterStatusDomainService characterDomainService; | ||
|
|
||
| @TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT) | ||
| @Transactional(propagation = Propagation.REQUIRES_NEW) | ||
| public void handleGameCharacterLevelUp(GameLevelUpEvent event) { | ||
|
|
||
| try { | ||
| characterDomainService.gameCharacterLevelUp(event.userId(), event.isProblemSolved(), | ||
| event.problemCategory()); | ||
| } catch (GameException ge) { | ||
| log.info("현재 해당 사용자는 게임 캐릭터를 생성한 상태가 아닙니다. {}", ge.getMessage()); | ||
| TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); | ||
| } catch (Exception e) { | ||
| log.warn("문제 풀이로 인한 레벨업 실패 Unknown Error 발생", e); | ||
| TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ure/event/service/ChatEventPublisher.java → ...e/event/publisher/ChatEventPublisher.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ucture/event/service/DiscordNotifier.java → ...ture/event/publisher/DiscordNotifier.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...t/service/NotificationEventPublisher.java → ...publisher/NotificationEventPublisher.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/main/java/org/ezcode/codetest/infrastructure/event/publisher/ProblemEventPublisher.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package org.ezcode.codetest.infrastructure.event.publisher; | ||
|
|
||
| import org.ezcode.codetest.domain.submission.model.entity.UserProblemResult; | ||
| import org.ezcode.codetest.infrastructure.event.dto.GameLevelUpEvent; | ||
| import org.springframework.context.ApplicationEventPublisher; | ||
| import org.springframework.stereotype.Component; | ||
|
|
||
| import lombok.RequiredArgsConstructor; | ||
|
|
||
| @Component | ||
| @RequiredArgsConstructor | ||
| public class ProblemEventPublisher { | ||
|
|
||
| private final ApplicationEventPublisher publisher; | ||
|
|
||
| public void publishProblemSolveEvent(UserProblemResult event) { | ||
|
|
||
| Long userId = event.getUser().getId(); | ||
| boolean isCorrect = event.isCorrect(); | ||
| String problemCategory = event.getProblem().getCategory().getDescription(); | ||
|
|
||
| publisher.publishEvent(new GameLevelUpEvent(userId, isCorrect, problemCategory)); | ||
| } | ||
|
Comment on lines
+16
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 널 안전성 검증 추가 필요 현재 구현에서는 다음과 같이 수정하여 null 안전성을 보장해주세요: public void publishProblemSolveEvent(UserProblemResult event) {
+ if (event == null || event.getUser() == null || event.getProblem() == null
+ || event.getProblem().getCategory() == null) {
+ throw new IllegalArgumentException("UserProblemResult와 관련 객체들은 null일 수 없습니다");
+ }
Long userId = event.getUser().getId();
boolean isCorrect = event.isCorrect();
String problemCategory = event.getProblem().getCategory().getDescription();
publisher.publishEvent(new GameLevelUpEvent(userId, isCorrect, problemCategory));
}🤖 Prompt for AI Agents |
||
| } | ||
2 changes: 1 addition & 1 deletion
2
...vent/service/RedisJudgeQueueProducer.java → ...nt/publisher/RedisJudgeQueueProducer.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...re/event/service/StompMessageService.java → .../event/publisher/StompMessageService.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ing/interceptor/ChatLimitInterceptor.java → ...ing/interceptor/ChatLimitInterceptor.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ngmanagement/view/ChatViewController.java → ...ion/chatting/view/ChatViewController.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🛠️ Refactor suggestion
토큰 파라미터 처리 로직의 확장성과 유지보수성을 개선해주세요.
현재 구현에서 몇 가지 개선 사항이 필요합니다:
다음과 같이 리팩토링을 제안합니다:
📝 Committable suggestion
🤖 Prompt for AI Agents