-
Notifications
You must be signed in to change notification settings - Fork 0
fix: 물품 승인 처리 및 소유권 승인 관련 문제 #197
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
The head ref may contain hidden characters: "fix/#196/\uBB3C\uD488-\uC0C1\uD0DC-\uC774\uC0C1\uD568"
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -144,6 +144,7 @@ public void processApproval(ApprovalStatus approvalStatus, User approver) { | |||
|
|
||||
| if (approvalStatus == ApprovalStatus.APPROVED) { | ||||
| this.approvalStatus = ApprovalStatus.APPROVED; | ||||
| this.status = ItemStatus.GIVEN; | ||||
|
||||
| this.status = ItemStatus.GIVEN; |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -29,6 +29,11 @@ public void giveRewardToStudent(Long studentId, Long itemId, User currentUser) { | |||||||||
| Item item = itemRepository.findById(itemId) | ||||||||||
| .orElseThrow(() -> new IllegalArgumentException("물품을 찾을 수 없습니다.")); | ||||||||||
|
|
||||||||||
| // 중복 상점 지급 방지 | ||||||||||
| if (rewardRecordRepository.existsByItemId(itemId)) { | ||||||||||
| throw new IllegalStateException("이미 상점이 지급된 물품입니다."); | ||||||||||
| } | ||||||||||
|
|
||||||||||
|
Comment on lines
+32
to
+36
|
||||||||||
| // 중복 상점 지급 방지 | |
| if (rewardRecordRepository.existsByItemId(itemId)) { | |
| throw new IllegalStateException("이미 상점이 지급된 물품입니다."); | |
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,7 +38,7 @@ public class RewardRecord { | |
| @Builder | ||
| public RewardRecord(User student, Item item, User teacher) { | ||
| validateTeacherRole(teacher); | ||
| validateItemNotGiven(item); | ||
| validateItemGiven(item); | ||
| this.student = student; | ||
| this.item = item; | ||
| this.teacher = teacher; | ||
|
|
@@ -52,10 +52,10 @@ private void validateTeacherRole(User user) { | |
| } | ||
| } | ||
|
|
||
| // 물품이 이미 지급되지 않았는지 검증 | ||
| private void validateItemNotGiven(Item item) { | ||
| if (item.isGiven()) { | ||
| throw new IllegalStateException("이미 지급된 물품입니다."); | ||
| // 물품이 지급 완료 상태인지 검증 | ||
| private void validateItemGiven(Item item) { | ||
| if (!item.isGiven()) { | ||
| throw new IllegalStateException("지급 처리되지 않은 물품입니다."); | ||
|
Comment on lines
+56
to
+58
|
||
| } | ||
| } | ||
| } | ||
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.
소유권 주장을 승인할 때 item.processApproval()을 호출하는 것은 좋은 변경이지만, processApproval()에서 status를 GIVEN으로 설정하는 것(Item.java line 147)은 문제를 일으킵니다.
소유권 승인(claim approval)과 물품 승인(item approval)은 다른 개념일 수 있으므로, 이 호출이 적절한지 재검토가 필요합니다.
시스템에 다음 두 가지 승인 플로우가 있습니다:
두 플로우가 일관되게 동작하는지 확인이 필요합니다.