Open
Conversation
woong2e
reviewed
Dec 31, 2025
Comment on lines
42
to
51
| // READ: 단건 조회 | ||
| public Product getProduct(Long productid) { | ||
| return productRepository.findById(productid) | ||
| .orElseThrow(() -> new CustomException(ProductErrorStatus._INVALID_PRODUCT)); | ||
| } | ||
|
|
||
| // READ: 전체 조회 | ||
| public List<Product> getProducts() { | ||
| return productRepository.findAll(); | ||
| } |
Member
There was a problem hiding this comment.
조회 메서드에 @Transactional(readOnly = true)를 명시할 경우 여러 이점이 있습니다!
JPA 관련해서, 코드의 가독성 부분에서,,, 등등
Comment on lines
56
to
62
| public void removeStock(int quantity) { | ||
| if (this.stockQuantity < quantity) { | ||
| // 충분한 재고가 없을 경우 예외 처리 | ||
| throw new IllegalArgumentException("재고가 부족합니다."); | ||
| } | ||
| this.stockQuantity -= quantity; | ||
| } |
Member
There was a problem hiding this comment.
전역적으로 예외처리를 RestControllerAdvice를 통해 하고 있어, 저희 컨벤션에 맞게 Error코드 추가하고 CustomException을 던지는 방식으로 수정하시면 좋을것 같아요!
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
✅ PR 유형
🚀 작업 내용
작업한 내용 1
작업한 내용 2
📝️ 관련 이슈
💬 기타 사항 or 추가 코멘트