[BE-30] GetPostUseCase 확장 (모임 소속 상세 열람 인가, FR-2)

작업 내용 (설계 의도)

변경 사항

근거 TDD: 20260707-post-community-연동-tdd.md Sequence(상세 열람 인가). GetPostUseCase(application/post/usecase/GetPostUseCase.kt)에 requesterId: Long? 파라미터와 CommunityDomainService를 추가한다:

  1. val detail = postDomainService.getDetail(postId)
  2. detail.first.currentCommunityId?.let { communityDomainService.getCommunity(it, requesterId) } (FR-2 — 공개→통과/비공개 비멤버→403). 반환값은 인가 목적이라 무시
  3. return detail 전역 게시글은 분기 미진입(FR-4). requesterId=null + PRIVATE → getCommunity가 requireActiveMember에서 비멤버 처리→403.

롤백

requesterId optional·분기는 전역 경로 무영향.

의존

  • BE-25 (PostDomainService.getDetail)

다이어그램

처리 흐름

sequenceDiagram
    participant U as GetPostUseCase
    participant PDS as PostDomainService
    participant CDS as CommunityDomainService
    U->>PDS: getDetail(postId)
    PDS-->>U: (post, comments)
    alt post.communityId != null
        U->>CDS: getCommunity(communityId, requesterId)
    end

테스트 케이스

  • 전역 게시글 상세는 requesterId 없이도 조회된다
  • PUBLIC 모임 게시글 상세는 비멤버도 조회된다(FR-2)
  • PRIVATE 모임 게시글 상세를 비멤버가 조회 시 403
  • PRIVATE 모임 게시글을 requesterId=null로 조회 시 403