--- name: messaging description: 채널, 포스트, 스레드, 드래프트 등 핵심 메시징 기능 type: core --- # Messaging Domain ## 목적 / 책임 Mattermost의 핵심 메시징 기능: 채널, 포스트, 스레드, 리액션, 드래프트, 예약 포스트를 담당한다. ## 포함 경로 - `app/actions/local/channel.ts`, `post.ts`, `thread.ts`, `draft.ts`, `reactions.ts`, `scheduled_post.ts` - `app/actions/remote/channel.ts`, `post.ts`, `thread.ts`, `reactions.ts`, `search.ts` - `app/queries/servers/channel.ts`, `post.ts`, `thread.ts`, `drafts.ts`, `scheduled_post.ts`, `reaction.ts` - `app/database/models/server/channel*.ts`, `post.ts`, `thread*.ts`, `draft.ts`, `reaction.ts`, `scheduled_post.ts` - `app/screens/channel/`, `app/screens/thread/`, `app/screens/edit_post/` - `app/components/post_list/`, `app/components/post_draft/` ## 제외 경로 - `app/products/` (products는 각 product 도메인) - `app/actions/remote/user.ts` (user 도메인) ## 주요 구성 요소 - **Channel**: 채널 CRUD, 멤버십, 카테고리 관리 - **Post**: 포스트 생성/수정/삭제, 파일 첨부, 리액션 - **Thread**: 스레드 팔로우, 언급, 참여자 관리 - **Draft**: 임시저장, 예약 포스트 - **Search**: 채널/포스트 검색 ## 유지할 패턴 - Remote action: `fetchXxx()` → API 호출 → operator로 DB 저장 → `{error}` 반환 - Local action: DB 조작만 수행 - Sync handler는 create/update/delete 전체 라이프사이클을 처리한다 - `fetchMissingProfilesByIds()` 사용 - 직접 `client.getProfilesByIds()` 호출 금지 ## 다른 도메인과의 경계 - **database 도메인**: WatermelonDB 스키마 변경 시 `docs/database/server/server.md` 업데이트 필요 - **network 도메인**: API 호출은 `client/rest.ts`의 ClientMix 패턴 사용 - **ui 도메인**: 화면 렌더링은 ui 도메인, 데이터 로직은 이 도메인 ## 금지 사항 - `console.error()` / `console.log()` 직접 사용 (→ `logError()`, `logDebug()` 사용) - `TouchableOpacity` 사용 (→ `Pressable` 사용) - DB sync handler에서 삭제 누락 (stale 레코드는 `prepareDestroyPermanently()` 처리)