Skip to content
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

Merged
merged 12 commits into from
Aug 27, 2024

Conversation

belljun3395
Copy link
Collaborator

@belljun3395 belljun3395 commented Aug 27, 2024

🎫 연관 이슈

resolved: #363

💁‍♂️ PR 내용

  • SubscribeWorkbookUseCase 모델 변환

🙏 작업

  • SubscribeWorkbookUseCase의 로직을 모델로 변환하였습니다.

🙈 PR 참고 사항

📸 스크린샷

스크린샷 2024-08-27 오전 10 27 08

첫 구독

스크린샷 2024-08-27 오전 10 30 56

구독 중

스크린샷 2024-08-27 오전 10 32 10

재구독

스크린샷 2024-08-27 오전 10 33 27

구독 완료

🤖 테스트 체크리스트

  • 체크 미완료
  • 체크 완료

@github-actions github-actions bot added the refactor 기존 기능에 대해 개선할 때 사용됩니다. label Aug 27, 2024
Comment on lines +8 to +18
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."
}
}
}
Copy link
Collaborator Author

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) {
Copy link
Collaborator Author

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(
Copy link
Collaborator Author

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를 상속한 새로운 객체를 만드는 것이 좋을 것이라 생각하였습니다.

Comment on lines +13 to +17
init {
require(isCancelSub) {
"CanceledWorkbookSubscriptionHistory is not for active subscription."
}
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CancelledWorkbookSubscriptionHistory 생성에 대한 검증입니다.

@belljun3395 belljun3395 merged commit dd4fb32 into dev Aug 27, 2024
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor 기존 기능에 대해 개선할 때 사용됩니다.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SubscribeWorkbookUseCase 모델 변환
1 participant