-
Notifications
You must be signed in to change notification settings - Fork 0
편지 검증 flow
Sim-km edited this page Sep 12, 2024
·
1 revision
sequenceDiagram
participant User
participant VerifyLetterAccessibleUsecase
participant LetterCommandService
participant SendLetterManagementPort
participant UserManagementPort
participant LetterException
User ->> VerifyLetterAccessibleUsecase: verify(command)
VerifyLetterAccessibleUsecase ->> LetterCommandService: verify(command)
Note right of LetterCommandService: 편지가 이전에 검증되었는지 확인
LetterCommandService ->> SendLetterManagementPort: verifiedLetter(DomainId(command.userId), command.letterCode)
alt 동일한 사용자가 열람한적이 있음
LetterCommandService ->> SendLetterManagementPort: getExpiredLetterNotNull(DomainId(command.userId), command.letterCode)
SendLetterManagementPort -->> LetterCommandService: sendLetter
LetterCommandService ->> VerifyLetterAccessibleUsecase: VerifyLetterAccessibleUsecase.Response(letterId = sendLetter.id.value)
else 이전에 열람한 적 없음
LetterCommandService ->> SendLetterManagementPort: getLetterByCodeNotNull(command.letterCode)
SendLetterManagementPort -->> LetterCommandService: sendLetter
LetterCommandService ->> UserManagementPort: getUserNotNull(DomainId(command.userId))
UserManagementPort -->> LetterCommandService: user
LetterCommandService ->> sendLetter: isSameReceiver { user.username }
alt 수신자 이름과 동일함
LetterCommandService ->> SendLetterManagementPort: expireLetter(DomainId(command.userId), sendLetter.id)
SendLetterManagementPort -->> LetterCommandService: expired
LetterCommandService ->> VerifyLetterAccessibleUsecase: VerifyLetterAccessibleUsecase.Response(letterId = sendLetter.id.value)
else 수신자 이름과 동일하지 않음
LetterCommandService ->> LetterException: throw InvalidLetterAccessException()
end
end