[BE-34] PostApiController + CreatePostRequest 확장 (작성 분기·검색 필터·상세 requester)

작업 내용 (설계 의도)

변경 사항

근거 TDD: 20260707-post-community-연동-tdd.md API 계약. PostApiController(presentation/post/controller/PostApiController.ktCreatePostRequest(presentation/post/dto/request/CreatePostRequest.kt)를 확장한다(단일 writer):

  • CreatePostRequestcommunityId: Long?·sportCategory: SportCategory? 추가.
  • POST /postsrequest.communityId == nullCreatePostUseCase(전역), else → CreateCommunityPostUseCase(모임). 얇은 분기.
  • GET /postscommunityId·sportCategory 쿼리 파라미터 추가 → 확장된 PostCriteria(globalFeedOnly=true).
  • GET /posts/{id}@RequestHeader("X-User-Id", required=false) requesterId: Long? 추가 → getPostUseCase.execute(id, requesterId). NoticeRequiresHostException·NotCommunityMemberException → 403 매핑(기존 예외 핸들러 재사용/추가).

롤백

분기·파라미터 additive, 이전 이미지 재기동.

의존

  • BE-28 (Create UseCases)
  • BE-30 (GetPostUseCase requesterId)
  • BE-32 (SearchPostsUseCase 필터)
  • BE-27 (PostResponse 필드)

다이어그램

클래스 의존

flowchart LR
    Ctl[PostApiController] -->|communityId null| CreatePostUseCase
    Ctl -->|communityId 있음| CreateCommunityPostUseCase
    Ctl -->|GET 필터| SearchPostsUseCase
    Ctl -->|GET id + X-User-Id| GetPostUseCase

테스트 케이스

  • POST /posts (communityId 없음) → 전역 게시글 201
  • POST /posts (communityId 있음, ACTIVE) → 모임 게시글 201
  • POST /posts (communityId 있음, 비멤버) → 403
  • POST /posts (모임 NOTICE, 비host) → 403
  • GET /posts?sportCategory=RUNNING → 러닝 게시글 페이지
  • GET /posts/{id} (PRIVATE 모임, X-User-Id 비멤버) → 403
  • GET /posts/{id} (전역, X-User-Id 없음) → 200