-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Refactor/#363] SubscribeWorkbookUseCase 모델 변환 #365
Conversation
init { | ||
if (isNew) { | ||
require(workbookSubscriptionStatus == null) { | ||
"If new subscription, workbookSubscriptionStatus should be null." | ||
} | ||
} else { | ||
require(workbookSubscriptionStatus != null) { | ||
"If not new subscription, workbookSubscriptionStatus should not be null." | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
새로 생성된 구독인가에 따라 분기가 나뉘기 때문에 init에 해당 내용을 검증하는 코드를 추가하였습니다.
isNew
- true : 새로 생성된 구독이기 때문에 workbookSubscriptionStatus 가 없어야 함
- false: 이미 구독한 것이기 때문에 workbookSubscriptionStatus가 있어야 함
|
||
init { | ||
if (isNew) { | ||
require(workbookSubscriptionStatus == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
require은 괄호 안이 false일 경우 {} 안의 내용과 함께 IllegalArgumentException이 발생합니다.
@@ -0,0 +1,25 @@ | |||
package com.few.api.domain.subscription.usecase.model | |||
|
|||
class CancelledWorkbookSubscriptionHistory( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
취소된 WorkbookSubscriptionHistory를 분리해서 구현하였습니다.
-> 기존의 WorkbookSubscriptionHistory에는 WorkbookSubscriptionHistory가 nullable이기 때문에 WorkbookSubscriptionHistory에 대한 접근을 보장할 수 없습니다. 하지만 CancelledWorkbookSubscriptionHistory는 WorkbookSubscriptionHistory에 대한 접근이 필요하여 WorkbookSubscriptionHistory를 상속한 새로운 객체를 만드는 것이 좋을 것이라 생각하였습니다.
init { | ||
require(isCancelSub) { | ||
"CanceledWorkbookSubscriptionHistory is not for active subscription." | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CancelledWorkbookSubscriptionHistory 생성에 대한 검증입니다.
…refactor/#363_belljun3395
🎫 연관 이슈
resolved: #363
💁♂️ PR 내용
🙏 작업
🙈 PR 참고 사항
📸 스크린샷
첫 구독
구독 중
재구독
구독 완료
🤖 테스트 체크리스트