@startuml !theme mono title Flow 5: 회의 종료 및 Todo 자동 추출 (Meeting End and Auto Todo Extraction) actor "사용자\n(User)" as User participant "Web App" as Web participant "API Gateway" as Gateway participant "Meeting Service" as Meeting participant "STT Service" as STT participant "AI Service" as AI participant "Todo Service" as Todo participant "Notification Service" as Notification queue "RabbitMQ" as MQ database "Redis" as Cache database "PostgreSQL" as DB == 회의 종료 (Meeting End) == User -> Web: 1. 회의 종료 버튼 클릭\n(Click "End Meeting" button) activate Web Web -> Gateway: 2. PATCH /api/meetings/{meetingId}/end\n(End meeting request) activate Gateway Gateway -> Meeting: 3. 회의 종료 요청\n(Forward end meeting request) activate Meeting Meeting -> DB: 4. 회의 상태 조회\n(Query meeting status) activate DB DB --> Meeting: 회의 정보 반환\n(Return meeting info) deactivate DB Meeting -> DB: 5. 회의 상태를 "ended"로 업데이트\n종료 시간 기록\n(Update status to "ended", record end time) activate DB DB --> Meeting: 업데이트 완료\n(Update confirmed) deactivate DB Meeting -> DB: 6. 회의 통계 생성\n(참여자 수, 발언 시간, 총 시간 등)\n(Generate meeting statistics) activate DB DB --> Meeting: 통계 저장 완료\n(Statistics saved) deactivate DB Meeting -> Cache: 7. 캐시 업데이트\n(Update cache with final status) activate Cache Cache --> Meeting: 캐시 업데이트 완료\n(Cache updated) deactivate Cache Meeting ->> MQ: 8. "MeetingEnded" 이벤트 발행\n(Publish "MeetingEnded" event)\n{meetingId, endTime, stats} activate MQ Meeting --> Gateway: 9. 회의 종료 응답\n(Return end meeting response) deactivate Meeting Gateway --> Web: 10. 종료 확인 응답\n(Return confirmation) deactivate Gateway Web --> User: 11. 회의 종료 완료 메시지 표시\n(Display meeting ended message) deactivate Web == STT 녹음 중지 (Stop STT Recording) == MQ ->> STT: 12. "MeetingEnded" 이벤트 수신\n(Receive "MeetingEnded" event) activate STT STT -> STT: 13. 녹음 중지 및 최종 처리\n(Stop recording and final processing) STT -> DB: 14. 최종 음성 데이터 저장\n(Save final audio data) activate DB DB --> STT: 저장 완료\n(Save confirmed) deactivate DB STT -> DB: 15. 전사 완료 상태 업데이트\n(Update transcription status to completed) activate DB DB --> STT: 업데이트 완료\n(Update confirmed) deactivate DB deactivate STT deactivate MQ == AI Todo 자동 추출 (AI Auto Todo Extraction) == MQ ->> AI: 16. "MeetingEnded" 이벤트 수신\n(Receive "MeetingEnded" event) activate MQ activate AI AI -> DB: 17. 전체 회의록 조회\n(Query full transcript) activate DB DB --> AI: 회의록 텍스트 반환\n(Return transcript text) deactivate DB AI -> AI: 18. AI 분석 수행\n- 실행 항목(Action Items) 식별\n- 담당자(Assignee) 추출\n- 마감일 추론\n(AI analysis:\n- Identify action items\n- Extract assignees\n- Infer deadlines) AI -> DB: 19. AI 추출 결과 저장\n(Save AI extraction results) activate DB DB --> AI: 저장 완료\n(Save confirmed) deactivate DB AI ->> MQ: 20. "TodoExtracted" 이벤트 발행\n(Publish "TodoExtracted" event)\n{meetingId, todos: [{description, assignee, dueDate, transcriptSection}]} deactivate AI == Todo 생성 및 연결 (Todo Creation and Linking) == MQ ->> Todo: 21. "TodoExtracted" 이벤트 수신\n(Receive "TodoExtracted" event) activate Todo loop 각 Todo 항목마다 (For each todo item) Todo -> DB: 22. Todo 생성\n- 회의 연결 (meetingId)\n- 전사 섹션 연결 (transcriptSectionId)\n- 담당자 정보\n- 마감일\n(Create todo with:\n- Meeting link\n- Transcript section link\n- Assignee info\n- Due date) activate DB DB --> Todo: Todo 생성 완료\n(Todo created) deactivate DB Todo ->> MQ: 23. "TodoCreated" 이벤트 발행\n(Publish "TodoCreated" event)\n{todoId, meetingId, assignee} end deactivate Todo == 담당자 알림 (Assignee Notification) == MQ ->> Notification: 24. "TodoCreated" 이벤트 수신\n(Receive "TodoCreated" event) activate Notification Notification -> DB: 25. 담당자 정보 조회\n(Query assignee information) activate DB DB --> Notification: 사용자 정보 및 이메일\n(Return user info and email) deactivate DB Notification -> Notification: 26. Todo 할당 이메일 생성\n- Todo 내용\n- 마감일\n- 회의록 링크\n(Generate todo assignment email:\n- Todo description\n- Due date\n- Transcript link) Notification -> Notification: 27. 이메일 발송\n(Send email to assignee) Notification -> DB: 28. 알림 전송 기록 저장\n(Save notification log) activate DB DB --> Notification: 저장 완료\n(Save confirmed) deactivate DB deactivate Notification deactivate MQ @enduml