Support 도메인 모델
개요
Support 도메인의 상세한 도메인 모델을 정의합니다. 도메인 이벤트, 엔티티, 열거형, 값 객체, Aggregate, Domain Service, 에러 코드를 포함합니다.
1. 도메인 이벤트
1.1 내부 이벤트 (Internal Events)
Support 도메인 내 Aggregate에서 발행하는 이벤트:
OutboundCompleted
- Payload:
userId,userCycleId,userOutboundId - Trigger: CompleteOutbound 커맨드 성공 시
- 발행: UserOutboundPlan
- 구독: -
OutboundSkipped
- Payload:
userId,userCycleId,userOutboundId - Trigger: SkipOutbound 커맨드 성공 시
- 발행: UserOutboundPlan
- 구독: -
OutboundWithdrawn
- Payload:
userId,userCycleId,userOutboundId - Trigger: RevokeOutbound 커맨드 성공 시
- 발행: UserOutboundPlan
- 구독: -
OutboundScheduleRecorded
- Payload:
userId,userCycleId,userOutboundId,scheduleAt - Trigger: RecordOutboundSchedule 커맨드 성공 시
- 발행: UserOutboundPlan
- 구독: -
LastOutboundAutoCompleted
- Payload:
userId,userCycleId - Trigger: CompeleteLastOutboundAuto 명령 성공 시
- 발행: UserOutboundPlan
- 구독: -
MissedCallMessageSent
- Payload:
userId,userCycleId,userOutboundId,messageId,templateId?,dayIndex - Trigger: SendMissedCallMessage 명령 성공 시
- 발행: UserSupportMessage
- 구독: UserSupportLog
MissedCallMessageFailed
- Payload:
userId,userCycleId,userOutboundId,reason,dayIndex - Trigger: SendMissedCallMessage 명령 실패 시
- 발행: UserSupportMessage
- 구독: UserSupportLog
UserMemoCreated
- Payload:
userId,userCycleId,memo,dayIndex - Trigger: CreateUserMemo 명령 성공 시
- 발행: UserSupportMemo
- 구독: UserSupportLog
UserMemoUpdated
- Payload:
userId,userCycleId,memoId,memo,dayIndex - Trigger: UpdateUserMemo 명령 성공 시
- 발행: UserSupportMemo
- 구독: UserSupportLog
UserIssueCreated
- Payload:
userId,userCycleId,issue,dayIndex - Trigger: CreateIssue 명령 성공 시
- 발행: UserSupportIssue
- 구독: UserSupportLog
UserIssueUpdated
- Payload:
userId,userCycleId,issueId,memo,dayIndex - Trigger: UpdateIssue 명령 성공 시
- 발행: UserSupportIssue
- 구독: UserSupportLog
UserIssueStatusChanged
- Payload:
userId,userCycleId,issueId,memo,outboundDay - Trigger: ChangeIssueStatus 명령 성공 시
- 발행: UserSupportIssue
- 구독: UserSupportLog
1.2 외부 이벤트 (Subscribed External Events)
다른 도메인에서 발행하는 이벤트를 구독:
Inbound: LastSurveyCompleted
- Payload:
userId,userCycleId - Source: Outbound Management Context
Outbound: UserSiteUpdateRequested
- Target: Site Context
Outbound: UserMdUpdateRequested
- Target: Site
Outbound: UserMdDeleteRequested
- Target: Site
2. 엔티티 (Entities)
OutboundPlan
id: 식별자sequence: 순서dayIndex: 일차isActive: 활성화 여부createdAt: 생성일updatedAt: 수정일
UserOutboundPlan
id: 식별자userId: 사용자 iduserCycleId: 사용주기 idsequence: 순서dayIndex: 관리 일차 (n일차)status: 상태 (UserOutboundStatus)planDate: 관리 일자 (yyyy-MM-dd)contactAt: 연락 일자resolvedBy: 처리한 운영자 idresolvedAt: 처리 일자createdAt: 생성일updatedAt: 수정일
UserSupportMemo
id: 식별자: 식별자 (number)userId: 사용자 iduserCycleId: 사용주기 idmemo: 메모 내용createdBy: 운영자 idcreatedAt: 생성일updatedAt: 수정일
UserSupportIssue
id: 식별자: 식별자 (number)userId: 사용자 iduserCycleId: 사용주기 idissue: 이슈 내용status: 이슈 상태 (UserSupportIssueStatus)createdBy: 운영자 idcreatedAt: 생성일updatedAt: 수정일
UserSupportLog
id: 식별자 (number)userId: 사용자 iduserCycleId: 사용주기 idtype: 로그 타입 (UserSupportLogType)dayIndex: 일차meta: 데이터relationId: 연관 idcreatedAt: 생성일updatedAt: 수정일
UserSupportMessage
id: 식별자 (number)userId: 사용자 iduserCycleId: 사용주기 iduserOutboundId: 연결된 콜 idmessageType: 메시지 유형 (템플릿/자유 텍스트/부재중)templateId: 템플릿 메시지 사용 시 템플릿 idcontent: 발송된 메시지 내용status: 발송 상태 (성공/실패/재시도 대기)createdBy: 운영자 idcreatedAt: 생성일updatedAt: 수정일
3. 열거형 (Enums)
UserOutboundStatus
PENDING: 대기COMPLETED: 완료SKIPPED: 건너뜀ACTIVE: 활성 (PENDING+planDate)
UserSupportIssueStatus
REGISTERED: 등록IN_PROGRESS: 진행RESOLVED: 해결CANCELLED: 취소
UserSupportLogType
LOG: 로그MEMO: 메모 (LOG)ISSUE: 이슈 (PATIENT_ISSUE)CONTACT_SCHEDULE_CHANGE: 연락 스케줄 변경 (CALL_SCHEDULE_CHANGE)OUTBOUND_STATUS_CHANGE: 아웃바운드 관리 상태 (FOLLOW_UP_STATUS_CHANGE)ACCOUNT_UPDATED: 처방의 변경ACCOUNT_DELETED: 처방의 삭제SITE_UPDATE: 처방병원 변경MESSAGE_SENT: 메시지/부재중 메시지 발송 기록
3. 값 객체 (Value Objects)
UserOutboundStatusVO
status: 상태 (UserOutboundStatus)- 동등성: status가 같은 값
LogVO
type: 로그 타입meta: 메타 데이터- 동등성: type과 meta가 같은 값
4. Aggregates
UserOutboundPlan
Methods:
complete()skip()withdraw()setSchedule()
Repository:
findById(id)findByUserCycleId(userCycleId)findByUserCycleIdAndSequence(userCycleId, sequence)save(userOutboundPlan)
Events:
OutboundCompletedOutboundSkippedOutboundWithdrawnOutboundScheduleRecordedLastOutboundAutoCompleted
UserSupportMemo
Methods:
create()canUpdate()update()
Repository:
findById(id)save(memo)
Events:
UserMemoCreatedUserMemoUpdated
UserSupportLog
Methods:
record()getLogs(userId)
Repository
findById(id)findByUserCycleId(userCycleId)
Events:
SupportLogHistoryRecorded
UserSupportIssue
Methods:
create()update()resolve()cancel()canUpdate()
Repository:
findById(issue)
save(issue)
Events:
UserIssueCreatedUserIssueUpdatedUserIssueStatusChanged
UserSupportMessage
Methods:
sendTemplateMessage()sendFreeTextMessage()sendMissedCallMessage()
Repository
save(message)findByUserCycleId(userCycleId)findByOutboundId(outboundId)
Events:
TemplateMessageSentFreeTextMessageSentMissedCallMessageSentMissedCallMessageFailed
UserSupport
Methods:
findUsers()
Repository:
Events:
UserSiteUpdateRequestedUserMdUpdateRequestedUserMdDeleteRequested
UserSupportMessage
Methods:
sendTemplateMessage()sendFreeTextMessage()
6. Error Codes
6.1 클라이언트 에러 (4xx)
4001 INVALID_CALL_STATUS: 유요하지 않은 상태4002 CALL_ALREADY_COMPLETED: 이미 완료된 콜4003 MEMO_CONTENT_TOO_LOG: 메모 내용 초과4004 UNAUTHORIZED_ACTION: 권한 없음4005 UPDATED_FAIL: 메모 수정 실패4006 MEMO_UPDATED_FAIL: 메모 수정 실패4007 CONTECT_SCHEDULE_RECORD_FAIL: 메모 수정 실패
변경 이력
| 버전 | 날짜 | 작성자 | 변경 내용 |
|---|---|---|---|
| 0.58.0 | 2025-12-15 | mook@weltcorp.com | 문서 생성 |