Skip to content

Conversation

@joyewon0705
Copy link
Collaborator

📌 개요

  • 특정 게시글에 등록된 댓글 목록을 조회할 수 있는 API를 구현했습니다.
  • 부모 댓글 기준으로 페이징 처리하며, 각 부모 댓글에는 자식 댓글(children)이 계층 구조로 포함됩니다.

🔨 작업 내용

1. Controller

  • GET /api/posts/{postId}/comments → 댓글 다건 조회 엔드포인트 구현

2. Service

  • CommentService#getComments
    • 게시글 존재 여부 검증
    • CommentRepositoryCustom을 통해 댓글/대댓글 조회
    • PageResponse<CommentListResponse> 형태로 반환

3. Repository

  • CommentRepositoryImpl#getCommentsByPostId
    • QueryDSL 기반 구현
    • 부모 댓글/자식 댓글 각각 조회
    • likeCount 집계 한 번에 처리
    • 부모-자식 매핑 후 Page 객체 반환

4. DTO

  • CommentListResponse
    • commentId, postId, parentId, author, content, likeCount, createdAt, updatedAt, children 필드 포함
    • @QueryProjection 사용

5. Swagger

  • CommentControllerDocs에 댓글 조회 API 문서 추가
    • 성공/실패/예외 응답 예시 작성

6. Test

  • Service Test

    • 댓글 조회 성공 (부모+자식 구조 확인)
    • 게시글 없음 예외 검증 (POST_001)
  • Controller Test

    • 성공 시 → 댓글 목록 + 대댓글 구조 반환 확인
    • 실패 시 → 게시글 없음 (404), 잘못된 파라미터 (400) 검증

🔗 관련 이슈

Closes #162

📝 참고 사항

  • 추후 최적화 및 가독성 향상을 위한 리팩토링 예정

✅ 체크리스트

  • 기능 동작 확인
  • 테스트 코드 작성
  • 문서/주석 추가 및 최신화

@github-actions github-actions bot changed the title Feat: 댓글 조회 API 구현 Feat: 댓글 조회 API 구현 (#162) Oct 3, 2025
@joyewon0705 joyewon0705 merged commit 9b6dfef into dev Oct 4, 2025
2 checks passed
@github-actions github-actions bot deleted the Feat/162 branch October 4, 2025 04:21
namgigun pushed a commit that referenced this pull request Oct 4, 2025
* Feat: 댓글 목록 조회 API 구현

* Test: 테스트 작성

* Docs: Swagger 문서 작성
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.

5 participants