Skip to content

Conversation

@ense333
Copy link
Collaborator

@ense333 ense333 commented Jul 28, 2025

🛠️ 작업 내용

댓글, 리뷰 dto -> record 클래스로 수정 및 테스트 코드 수정

image 의 경우 list만 담고 있는 dto를 제거하고 list 그 자체로 반환하도록 수정했습니다.

현재 limit와 offset, nativeQuery를 사용 통해 성능 개선을 진행하고 있어서 fetch join을 못쓴다는 문제가 있었습니다.
그에 따라 n+1문제를 해결하기 위해
image
위와 같이 2개의 쿼리로 나눠서 이를 해결하는 방안으로 진행했습니다.

그외에 comment, review의 경우에는 fetch join과 인터페이스 프로젝션 통해서 진행했습니다

✅ PR 유형

  • 새로운 기능 추가
  • CSS 등 사용자 UI 디자인 변경
  • 코드 리팩토링
  • 파일 혹은 폴더명 수정

✅ Check List

  • 코드가 정상적으로 컴파일되나요?
  • 테스트 코드를 통과했나요?
  • merge할 브랜치의 위치를 확인했나요?
  • Label을 지정했나요?

🔗 관련 이슈

💬 기타 참고 사항

@ense333 ense333 self-assigned this Jul 28, 2025
@ense333 ense333 linked an issue Jul 28, 2025 that may be closed by this pull request
Copy link
Collaborator

@iamjieunkim iamjieunkim left a comment

Choose a reason for hiding this comment

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

고생하셨습니다~ 확인했습니다!!

Copy link
Collaborator

@Ji-minhyeok Ji-minhyeok left a 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,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wrapper가 없을때 Json Response 형태는 기존과 동일하게 찍히는지 궁금합니다!

Copy link
Collaborator Author

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}
와 같이 응답 받아오는 것 확인했습니다!

@iamjieunkim
Copy link
Collaborator

한번 더 확인완료했습니다!!! 수고하셨습니당~👍

Copy link
Collaborator

@Ji-minhyeok Ji-minhyeok left a comment

Choose a reason for hiding this comment

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

N+1 문제는 미처 생각하지 못했네요. 추후 리팩토링에도 참고해서 다른 도메인에도 적용해보도록 하겠습니다!

@ense333 ense333 merged commit 0841f8a into develop Jul 29, 2025
2 checks passed
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.

[Refcator] 댓글, 리뷰 리펙토링

4 participants