[BE-28] 게시글 작성 UseCase (전역 확장 + 모임 신규, R1 배선점)
작업 내용 (설계 의도)
변경 사항
근거 TDD: 20260707-post-community-연동-tdd.md Detail Design “서비스 클래스” / Sequence(작성).
CreatePostUseCase(application/post/usecase/CreatePostUseCase.kt) 확장 —CreatePostCommand에sportCategory: SportCategory?추가, 전역 작성(인가 없음, FR-4/5). PostDomainService만 의존.CreateCommunityPostUseCase(신규) — R1 배선점.PostDomainService+CommunityDomainService(기존 public API) 주입:communityDomainService.requireActiveMember(communityId, userId)(FR-3 작성 게이트)val community = communityDomainService.getCommunity(communityId, userId)(엔티티 획득)postDomainService.createCommunityPost(..., community.sportCategory, community.isHostedBy(userId), community.isPublic())(FR-5 상속·FR-7 NOTICE)execute()≤10줄, if+throw 없음(인가는 DomainService/Entity가 throw).CreateCommunityPostCommand신규.
domain 무참조: UseCase는 application 레이어라 core→core 합법(R1 슬라이스 비대상).
롤백
신규 UseCase는 컨트롤러 분기 제거로 비활성.
의존
- BE-25 (PostDomainService.createCommunityPost/createPost)
다이어그램
처리 흐름
sequenceDiagram participant U as CreateCommunityPostUseCase participant CDS as CommunityDomainService participant PDS as PostDomainService U->>CDS: requireActiveMember(communityId, userId) U->>CDS: getCommunity(communityId, userId) CDS-->>U: community U->>PDS: createCommunityPost(..., sportCategory, isHostedBy, isPublic)
테스트 케이스
- ACTIVE 멤버가 모임 게시글을 작성하면 성공하고 sportCategory가 모임값으로 상속된다
- 비멤버가 모임 게시글 작성 시 NotCommunityMemberException(403)
- PENDING_APPROVAL 멤버 작성 시 거부된다(403)
- 일반 MEMBER가 NOTICE 작성 시 NoticeRequiresHostException(403)
- HOST가 NOTICE 작성 시 성공한다
- 전역 CreatePostUseCase는 communityDomainService 무의존으로 기존대로 동작한다(NOTICE 제한 없음)