-
Notifications
You must be signed in to change notification settings - Fork 0
feat: 입고 확정 기능 구현 #94
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
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e06424f
feat: 입고 확정 응답 DTO 추가
JoonKyoLee 7e967b7
feat: 입고 확정 서비스 로직 추가
JoonKyoLee fa008a7
feat: 입고 확정 API 추가
JoonKyoLee d570a94
test: 입고 확정 서비스 로직 테스트 추가
JoonKyoLee 56860d2
test: 입고 확정 API 테스트 추가
JoonKyoLee b2e181b
feat: 입고 엔티티 내에 취소 및 확정 전 유효성 검사 로직 추가
JoonKyoLee 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
Some comments aren't visible on the classic Files Changed page.
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
5 changes: 5 additions & 0 deletions
5
src/main/java/com/almang/inventory/receipt/dto/response/ConfirmReceiptResponse.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,5 @@ | ||
| package com.almang.inventory.receipt.dto.response; | ||
|
|
||
| public record ConfirmReceiptResponse( | ||
| boolean success | ||
| ) {} |
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
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.
입고 확정 전 비즈니스 검증 로직이 부족합니다.
현재 구현은 사용자 권한만 확인하고 입고의 상태는 검증하지 않습니다. 다음 사항들을 추가 검증해야 합니다:
개선 제안:
@Transactional public ConfirmReceiptResponse confirmReceipt(Long receiptId, Long userId) { User user = findUserById(userId); Store store = user.getStore(); log.info("[ReceiptService] 입고 확정 요청 - userId: {}, storeId: {}", userId, store.getId()); Receipt receipt = findReceiptByIdAndValidateAccess(receiptId, store); + + if (!receipt.isActivated()) { + throw new BaseException(ErrorCode.RECEIPT_ALREADY_DELETED); + } + if (receipt.getStatus() == ReceiptStatus.CONFIRMED) { + throw new BaseException(ErrorCode.RECEIPT_ALREADY_CONFIRMED); + } + if (receipt.getStatus() == ReceiptStatus.CANCELED) { + throw new BaseException(ErrorCode.RECEIPT_ALREADY_CANCELED); + } + receipt.confirm(); log.info("[ReceiptService] 입고 확정 성공 - receiptId: {}", receipt.getId()); return new ConfirmReceiptResponse(true); }참고: ErrorCode enum에 해당 에러 코드들을 추가해야 합니다. 비즈니스 검증은 도메인 계층에서 할 수도 있고 서비스 계층에서 할 수도 있습니다만, 일관성을 위해 기존 패턴을 따르세요.
🤖 Prompt for AI Agents