@startuml !theme mono title Flow 9: Todo 완료 및 회의록 반영 (Todo Completion and Transcript Update) actor User as user participant "Web App" as web participant "API Gateway" as gateway participant "Todo Service" as todo participant "RabbitMQ" as mq participant "Meeting Service" as meeting participant "Notification Service" as notification participant "Redis" as redis participant "PostgreSQL\n(Todo DB)" as tododb participant "PostgreSQL\n(Meeting DB)" as meetingdb participant "WebSocket\nConnection" as ws == Todo 완료 처리 (Todo Completion Processing) == user -> web: Todo 완료 버튼 클릭\n(Click "Complete" button) web -> gateway: PUT /api/todos/{todoId}/complete\n(Todo 완료 요청) gateway -> todo: PUT /todos/{todoId}/complete\n(Todo 완료 처리 요청) activate todo todo -> tododb: UPDATE todos\nSET status='COMPLETED',\ncompleted_at=NOW(),\ncompleted_by={userId}\nWHERE id={todoId} tododb --> todo: 완료 상태 저장 완료\n(Completion status saved) todo -> redis: DEL cache:todo:{todoId}\n(Todo 캐시 무효화) redis --> todo: 캐시 삭제 완료 todo --> gateway: 200 OK\n{todo: {..., status: "COMPLETED"}} gateway --> web: 200 OK web --> user: Todo 완료 표시\n(Show completion checkmark) == 비동기 이벤트 발행 (Async Event Publishing) == todo ->> mq: Publish "TodoCompleted"\n{todoId, meetingId, userId,\ncompletedAt} deactivate todo mq ->> meeting: Consume "TodoCompleted"\n(Todo 완료 이벤트 수신) activate meeting == 회의록 업데이트 (Meeting Transcript Update) == meeting -> redis: GET cache:transcript:{meetingId}\n(회의록 캐시 조회) alt 캐시 히트 (Cache Hit) redis --> meeting: 회의록 데이터 반환 else 캐시 미스 (Cache Miss) meeting -> meetingdb: SELECT * FROM transcripts\nWHERE meeting_id={meetingId} meetingdb --> meeting: 회의록 데이터 반환 end meeting -> meeting: Todo 섹션에 완료 상태 반영\n(Update todo section:\ncheckmark, completed_at,\ncompleted_by) meeting -> meetingdb: UPDATE transcripts\nSET content={updatedContent},\nupdated_at=NOW()\nWHERE meeting_id={meetingId} meetingdb --> meeting: 회의록 업데이트 완료 meeting -> redis: DEL cache:transcript:{meetingId}\n(회의록 캐시 무효화) redis --> meeting: 캐시 삭제 완료 == 알림 발송 (Notification Sending) == meeting ->> mq: Publish "TranscriptUpdated"\n{meetingId, updateType:\n"TODO_COMPLETED",\ntodoId, userId} deactivate meeting mq ->> notification: Consume "TranscriptUpdated"\n(회의록 업데이트 이벤트 수신) activate notification notification -> meetingdb: SELECT creator_id\nFROM transcripts\nWHERE meeting_id={meetingId} meetingdb --> notification: 회의록 작성자 ID 반환 notification -> notification: 알림 메시지 생성\n("Todo가 완료되었습니다") notification ->> user: 회의록 작성자에게\n완료 알림 전송\n(Send completion notification) deactivate notification == 실시간 동기화 (Real-time Sync) == mq ->> ws: Consume "TranscriptUpdated"\n(실시간 동기화 이벤트) activate ws ws -> redis: GET ws:participants:{meetingId}\n(현재 회의록 조회 중인\n참여자 목록 조회) redis --> ws: 참여자 WebSocket 세션 목록 loop 각 참여자에게 (For each participant) ws ->> web: WebSocket Push\n{type: "TODO_COMPLETED",\ntodoId, completedAt,\ncompletedBy} web -> web: 화면에 완료 상태 실시간 반영\n(Update UI with completion status) end deactivate ws @enduml