Open
Conversation
jjunhub
approved these changes
Jan 1, 2025
Member
jjunhub
left a comment
There was a problem hiding this comment.
테스트 코드까지 작성해보시느라 고생하셨습니다!!
페이징 관련해서 어려우셨을 것 같은데, 잘 마무리해주셨네요 :))
| return categoryService.updateCategory(categoryId, categoryUpdateRequest); | ||
| } | ||
|
|
||
| @DeleteMapping("/{categoryId}") |
Member
There was a problem hiding this comment.
Suggested change
| @DeleteMapping("/{categoryId}") | |
| @DeleteMapping("/categories/{categoryId}") |
여러 상황들을 고려하였을 때, 위처럼 수정하는 게 어떨까요?
만약 변경하지 않은 채로 클라이언트 측에서 api 요청 보내는 엔드포인트를 몇 개 살펴보면 아래와 같습니다.
/api/1-> 카테고리 id가 1인 카테고리 삭제/api/2-> 카테고리 id가 2인 카테고리 삭제
이렇게만 보면 api 요청이 어떤 것을 의미하는지 모호해질 것 같아서, 앞에 어떤 종류의 데이터를 다루는지가 endpoint에 들어가는 것이 RESTful한 API에 조금 더 가까워질 것 같습니다!
| } | ||
|
|
||
| if (productName == null || productDescription == null || productPrice == null || productStock == null || categoryId == null) { | ||
| return ProductUpdateResponse.fromError("400001", "상품 이름, 상품 설명, 상품 가격, 상품 재고, 카테고리 ID는 필수로 입력해주셔야 합니다."); |
Member
There was a problem hiding this comment.
꼼꼼하게 에러 처리하신 것 너무 좋습니다!!
이 부분에 대해서 스프링 단에서 유효성 검증 관련하여 지원해주는 기능이 있습니다.
링크 참조하시면 될 것 같아요!
|
|
||
| @RequiredArgsConstructor | ||
| @Service | ||
| @Transactional(readOnly = true) |
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.
User부분 합치지 않아서 error나는 부분은 주석처리 해서 올립니다.