Skip to content

[G팀 이상진] 백엔드 API 과제 제출 - #8

Open
silkair wants to merge 23 commits into
jinu0328:mainfrom
2024-Techeer-Partners-Team-G:assignment-sangjin
Open

[G팀 이상진] 백엔드 API 과제 제출#8
silkair wants to merge 23 commits into
jinu0328:mainfrom
2024-Techeer-Partners-Team-G:assignment-sangjin

Conversation

@silkair

@silkair silkair commented Nov 23, 2024

Copy link
Copy Markdown

[G팀 이상진] 백엔드 API 과제 제출입니다.

@jinu0328 jinu0328 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

과제 수행 고생 많으셨습니다!
몇가지 피드백을 남겼으니 참고해주시면 좋을 것 같습니다 👍

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API 응답의 ResponseEntity 구조가 거의 동일하게 반복되고 있습니다. status, message, data를 사용하는 구조를 반복적으로 작성하는 대신, 이를 하나의 공통 응답 객체로 관리하면 코드의 재사용성과 가독성을 크게 향상시킬 수 있을 것 같습니다. 현재 main 브랜치에도 그러한 방식으로 코드가 작성되어있으니 참고해주시면 좋을 것 같습니다! 👍

List<Task> tasks = taskService.getTasksByIsDone(true);
return ResponseEntity.status(200).body(tasks);
}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

응답에서 별도의 응답 dto가 아닌 Task 엔티티 객체를 직접 반환하고 있습니다. 이 방식은 직관적이고 현재 Task의 멤버가 적은 만큼 큰 단점이 없어보이지만 엔티티가 복잡해질 수록 꼭 엔티티의 모든 필드가 아닌 선택적으로 몇가지 필드만 클라이언트에게 반환해야하는 경우가 생기게 됩니다. 이를 위해 요청 dto뿐만 아닌 응답용 dto를 구현해서 활용하는 것도 좋을 것 같습니다 😄

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

위에 말씀드린 응답 dto를 활용한다면 set 메서드가 아닌 dto 변환 메서드를 통해 응답 객체를 간편하게 구성할 수 있습니다 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants