-
Notifications
You must be signed in to change notification settings - Fork 0
타이머 세션 도메인 구현 : feat : 연료 환율 30분=1연료 + 잔여분 이월(pendingMinutes) — 프론트 게… #39
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
The head ref may contain hidden characters: "20260422_#25_\uD0C0\uC774\uBA38_\uC138\uC158_\uB3C4\uBA54\uC778_\uAD6C\uD604"
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
17 changes: 17 additions & 0 deletions
17
...dy/src/main/java/com/elipair/spacestudyship/study/fuel/dto/FuelChargeFromStudyResult.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,17 @@ | ||
| package com.elipair.spacestudyship.study.fuel.dto; | ||
|
|
||
| /** | ||
| * 공부 세션에서 파생된 연료 충전 결과. | ||
| * | ||
| * 환율: 30분 = 1 연료. 30분 미만 잔여분은 {@code newPendingMinutes}에 누적되어 | ||
| * 다음 세션과 합산된다. | ||
| * | ||
| * @param amount 이번 호출로 충전된 연료 통 수 (0 이상) | ||
| * @param newPendingMinutes 충전 후 남은 잔여 분 (0~29) | ||
| * @param currentFuel 충전 후의 현재 연료 잔량 | ||
| */ | ||
| public record FuelChargeFromStudyResult( | ||
| int amount, | ||
| int newPendingMinutes, | ||
| int currentFuel | ||
| ) {} |
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
Oops, something went wrong.
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.
amount=0일 때 멱등성 보장이 누락됨result.amount() == 0인 경우(예: 기존 pendingMinutes가 0이고 studyMinutes가 30 미만) 트랜잭션이 저장되지 않습니다. 동일한sessionId로 재호출 시transactionRepository.findById(sessionId)가 빈 결과를 반환하여pendingMinutes가 중복 누적될 수 있습니다.현재는
TimerSessionService의idempotencyKey기반 검사가 상위 계층에서 보호하고 있지만, 이 메서드의 Javadoc에 명시된 멱등성 계약과 불일치합니다. 향후 직접 호출 시 데이터 불일치가 발생할 수 있습니다.🛡️ amount=0일 때도 멱등성 마커 트랜잭션 저장 제안
if (result.amount() > 0) { FuelTransaction tx = FuelTransaction.of( sessionId, userId, TransactionType.CHARGE, result.amount(), FuelReason.STUDY_SESSION, sessionId, fuel.getCurrentFuel()); transactionRepository.save(tx); + } else { + // amount=0이더라도 멱등성 보장을 위해 마커 트랜잭션 저장 + FuelTransaction tx = FuelTransaction.of( + sessionId, userId, TransactionType.CHARGE, + 0, FuelReason.STUDY_SESSION, + sessionId, fuel.getCurrentFuel()); + transactionRepository.save(tx); }📝 Committable suggestion
🤖 Prompt for AI Agents