Refactor: 게시판(Post/Comment) 레포지토리 및 패키지 구조 개선 (#166) #172
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.
📌 개요
🔨 작업 내용
1. PostRepositoryImpl 개선
검색/정렬 로직 리팩터링
likeCount,bookmarkCount,commentCount집계를 서브쿼리로 분리 → N+1 방지정렬 처리 개선
likeCount,bookmarkCount,commentCount)는 Java 메모리 단에서 정렬카테고리 주입 최적화
Page 객체 반환 구조 개선
2. CommentRepositoryImpl 개선
부모/자식 댓글 조회 로직 개선
likeCount 조회 최적화
정렬 처리 개선
likeCount는 메모리에서 후처리 정렬내부 메서드 분리
fetchComments,fetchLikeCounts,mapChildrenToParents,sortInMemoryIfNeeded등 세부 책임 분리3. board 패키지 구조 개선 (
03626bd)도메인 단위로 패키지 분리
board.comment.*: 댓글 관련 Controller, DTO, Entity, Repository, Serviceboard.post.*: 게시글 관련 Controller, DTO, Entity, Repository, Serviceboard.common.*: 공통 DTO (PageResponse, AuthorResponse 등)테스트 코드 리팩터링
CommentControllerTest,PostControllerTest,CommentServiceTest,PostServiceTest수정User 엔티티 참조 변경
com.back.domain.board.entity.*import → 세분화된board.comment.entity,board.post.entity로 교체🔗 관련 이슈
Closes #166
📝 참고 사항
✅ 체크리스트