[G팀 이상진] 백엔드 API 과제 제출 - #8
Open
silkair wants to merge 23 commits into
Open
Conversation
jinu0328
reviewed
Dec 2, 2024
jinu0328
left a comment
Owner
There was a problem hiding this comment.
과제 수행 고생 많으셨습니다!
몇가지 피드백을 남겼으니 참고해주시면 좋을 것 같습니다 👍
Owner
There was a problem hiding this comment.
API 응답의 ResponseEntity 구조가 거의 동일하게 반복되고 있습니다. status, message, data를 사용하는 구조를 반복적으로 작성하는 대신, 이를 하나의 공통 응답 객체로 관리하면 코드의 재사용성과 가독성을 크게 향상시킬 수 있을 것 같습니다. 현재 main 브랜치에도 그러한 방식으로 코드가 작성되어있으니 참고해주시면 좋을 것 같습니다! 👍
| List<Task> tasks = taskService.getTasksByIsDone(true); | ||
| return ResponseEntity.status(200).body(tasks); | ||
| } | ||
|
|
Owner
There was a problem hiding this comment.
응답에서 별도의 응답 dto가 아닌 Task 엔티티 객체를 직접 반환하고 있습니다. 이 방식은 직관적이고 현재 Task의 멤버가 적은 만큼 큰 단점이 없어보이지만 엔티티가 복잡해질 수록 꼭 엔티티의 모든 필드가 아닌 선택적으로 몇가지 필드만 클라이언트에게 반환해야하는 경우가 생기게 됩니다. 이를 위해 요청 dto뿐만 아닌 응답용 dto를 구현해서 활용하는 것도 좋을 것 같습니다 😄
Owner
There was a problem hiding this comment.
위에 말씀드린 응답 dto를 활용한다면 set 메서드가 아닌 dto 변환 메서드를 통해 응답 객체를 간편하게 구성할 수 있습니다 😄
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.
[G팀 이상진] 백엔드 API 과제 제출입니다.