[BE-25] PostDomainService 확장 (createCommunityPost·createPost·search)

작업 내용 (설계 의도)

변경 사항

근거 TDD: 20260707-post-community-연동-tdd.md Detail Design. PostDomainService(domain/post/service/PostDomainService.kt)에 다음을 추가/확장한다:

  • createPost(userId, title, content, type, sportCategory) — 전역 게시글(sportCategory 선택), Post.create 위임
  • createCommunityPost(userId, title, content, type, communityId, sportCategory, authorIsHost, communityIsPublic)Post.createInCommunity 위임(NOTICE 규칙은 Entity가 강제)
  • search/getPost/getDetail/addComment/listComments — 기존 시그니처 유지, 확장된 criteria만 소비

domain.post는 community 무참조 — community 사실은 인자(primitive/common.SportCategory)로만 수령. Repository만 주입(기존 3종).

롤백

메서드 additive.

의존

  • BE-23 (Post 팩토리)
  • BE-24 (PostSearchCriteria 필드)

다이어그램

처리 흐름

sequenceDiagram
    participant U as UseCase
    participant PDS as PostDomainService
    participant P as Post
    participant R as PostRepository
    U->>PDS: createCommunityPost(..., authorIsHost, communityIsPublic)
    PDS->>P: createInCommunity(...)
    P-->>PDS: post
    PDS->>R: save(post)
    R-->>U: saved

테스트 케이스

  • createCommunityPost가 Post.createInCommunity 결과를 저장·반환한다
  • createCommunityPost NOTICE+비host → NoticeRequiresHostException 전파
  • createPost(전역) sportCategory 지정/미지정 모두 저장된다
  • search가 확장 criteria(communityId·sportCategory·globalFeedOnly)를 그대로 CustomRepository에 위임한다
  • PostDomainService 파일에 domain.community import 0건 (R1)