[BE-31] ListCommentsUseCase 확장 (모임 소속 댓글 목록 열람 인가, FR-2)

작업 내용 (설계 의도)

변경 사항

근거 TDD: 20260707-post-community-연동-tdd.md Detail Design. ListCommentsUseCase(application/post/usecase/ListCommentsUseCase.kt)에 requesterId: Long?CommunityDomainService를 추가한다:

  1. val post = postDomainService.getPost(postId)
  2. post.currentCommunityId?.let { communityDomainService.getCommunity(it, requesterId) } (FR-2 열람 인가)
  3. return postDomainService.listComments(postId, page, size) 전역 게시글은 분기 미진입(FR-4).

롤백

분기는 전역 경로 무영향.

의존

  • BE-25 (PostDomainService.getPost/listComments)

다이어그램

처리 흐름

sequenceDiagram
    participant U as ListCommentsUseCase
    participant PDS as PostDomainService
    participant CDS as CommunityDomainService
    U->>PDS: getPost(postId)
    alt post.communityId != null
        U->>CDS: getCommunity(communityId, requesterId)
    end
    U->>PDS: listComments(postId, page, size)

테스트 케이스

  • 전역 게시글 댓글 목록은 인가 없이 조회된다
  • PUBLIC 모임 댓글 목록은 비멤버도 조회된다
  • PRIVATE 모임 댓글 목록을 비멤버가 조회 시 403
  • 댓글 0건 게시글은 빈 페이지를 반환한다(에러 아님)