-
Notifications
You must be signed in to change notification settings - Fork 2
refactor: 댓글, 리뷰 리펙토링 #124
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
Conversation
iamjieunkim
left a comment
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.
고생하셨습니다~ 확인했습니다!!
Ji-minhyeok
left a comment
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.
고생많으셨습니다!
| @GetMapping("/{lessonId}") | ||
| @Operation(summary = "댓글 조회", description = "레슨 ID에 해당되는 댓글들을 조회합니다.") | ||
| public ResponseEntity<PagedResponse<CommentPageWrapperDto>> readAll(@PathVariable Long lessonId, | ||
| public ResponseEntity<PagedResponse<List<CommentResponseDto>>> readAll(@PathVariable Long lessonId, |
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.
Wrapper가 없을때 Json Response 형태는 기존과 동일하게 찍히는지 궁금합니다!
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.
test 코드 실행시 Body = {"status":200,"message":"댓글 조회 성공","data":[{"commentId":1,"userId":1,"content":"댓글1","parentCommentId":1,"deleted":false,"createdAt":"2025-07-29T09:15:16.119127"},{"commentId":2,"userId":2,"content":"대댓글1","parentCommentId":1,"deleted":false,"createdAt":"2025-07-29T09:15:16.218364"},{"commentId":3,"userId":2,"content":"대댓글2","parentCommentId":1,"deleted":false,"createdAt":"2025-07-29T09:15:16.2414"}],"count":16}
와 같이 응답 받아오는 것 확인했습니다!
|
한번 더 확인완료했습니다!!! 수고하셨습니당~👍 |
Ji-minhyeok
left a comment
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.
N+1 문제는 미처 생각하지 못했네요. 추후 리팩토링에도 참고해서 다른 도메인에도 적용해보도록 하겠습니다!
🛠️ 작업 내용
댓글, 리뷰 dto -> record 클래스로 수정 및 테스트 코드 수정
현재 limit와 offset, nativeQuery를 사용 통해 성능 개선을 진행하고 있어서 fetch join을 못쓴다는 문제가 있었습니다.

그에 따라 n+1문제를 해결하기 위해
위와 같이 2개의 쿼리로 나눠서 이를 해결하는 방안으로 진행했습니다.
그외에 comment, review의 경우에는 fetch join과 인터페이스 프로젝션 통해서 진행했습니다
✅ PR 유형
✅ Check List
🔗 관련 이슈
💬 기타 참고 사항