-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 구독 테이블에 modified_at 칼럼 추가 * feat: 구독 전송 날짜, 시간 수정 쿼리 작성 * feat: 구독 전송 시간 수정 유즈케이스 구현 * feat: 구독 전송 요일 수정 유즈케이스 구현 * feat: 구독 전송 정보 수정 API 구현
- Loading branch information
1 parent
be5d051
commit c4ad770
Showing
12 changed files
with
303 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
.../kotlin/com/few/api/repo/dao/subscription/command/BulkUpdateSubscriptionSendDayCommand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.few.api.repo.dao.subscription.command | ||
|
||
data class BulkUpdateSubscriptionSendDayCommand( | ||
val memberId: Long, | ||
val day: String, | ||
val workbookIds: List<Long>, | ||
) |
9 changes: 9 additions & 0 deletions
9
...kotlin/com/few/api/repo/dao/subscription/command/BulkUpdateSubscriptionSendTimeCommand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.few.api.repo.dao.subscription.command | ||
|
||
import java.time.LocalTime | ||
|
||
data class BulkUpdateSubscriptionSendTimeCommand( | ||
val memberId: Long, | ||
val time: LocalTime, | ||
val workbookIds: List<Long>, | ||
) |
30 changes: 30 additions & 0 deletions
30
api/src/main/kotlin/com/few/api/domain/subscription/usecase/UpdateSubscriptionDayUseCase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.few.api.domain.subscription.usecase | ||
|
||
import com.few.api.domain.subscription.usecase.dto.UpdateSubscriptionDayUseCaseIn | ||
import com.few.api.repo.dao.subscription.SubscriptionDao | ||
import com.few.api.repo.dao.subscription.command.BulkUpdateSubscriptionSendDayCommand | ||
import org.springframework.stereotype.Component | ||
import org.springframework.transaction.annotation.Transactional | ||
|
||
@Component | ||
class UpdateSubscriptionDayUseCase( | ||
private val subscriptionDao: SubscriptionDao, | ||
) { | ||
@Transactional | ||
fun execute(useCaseIn: UpdateSubscriptionDayUseCaseIn) { | ||
/** | ||
* workbookId기 없으면, memberId로 구독중인 모든 workbookId를 가져와서 해당하는 모든 workbookId의 구독요일을 변경한다. | ||
*/ | ||
useCaseIn.workbookId ?: subscriptionDao.selectAllActiveSubscriptionWorkbookIds( | ||
SubscriptionDao.SelectAllActiveSubscriptionWorkbookIdsQuery(useCaseIn.memberId) | ||
).let { | ||
subscriptionDao.bulkUpdateSubscriptionSendDay( | ||
BulkUpdateSubscriptionSendDayCommand( | ||
useCaseIn.memberId, | ||
useCaseIn.dayCode.code, | ||
it | ||
) | ||
) | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
api/src/main/kotlin/com/few/api/domain/subscription/usecase/UpdateSubscriptionTimeUseCase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.few.api.domain.subscription.usecase | ||
|
||
import com.few.api.domain.subscription.usecase.dto.UpdateSubscriptionTimeUseCaseIn | ||
import com.few.api.repo.dao.subscription.SubscriptionDao | ||
import com.few.api.repo.dao.subscription.command.BulkUpdateSubscriptionSendTimeCommand | ||
import org.springframework.stereotype.Component | ||
import org.springframework.transaction.annotation.Transactional | ||
|
||
@Component | ||
class UpdateSubscriptionTimeUseCase( | ||
private val subscriptionDao: SubscriptionDao, | ||
|
||
) { | ||
@Transactional | ||
fun execute(useCaseIn: UpdateSubscriptionTimeUseCaseIn) { | ||
/** | ||
* workbookId기 없으면, memberId로 구독중인 모든 workbookId를 가져와서 해당하는 모든 workbookId의 구독요일을 변경한다. | ||
*/ | ||
useCaseIn.workbookId ?: subscriptionDao.selectAllActiveSubscriptionWorkbookIds( | ||
SubscriptionDao.SelectAllActiveSubscriptionWorkbookIdsQuery(useCaseIn.memberId) | ||
).let { | ||
subscriptionDao.bulkUpdateSubscriptionSendTime( | ||
BulkUpdateSubscriptionSendTimeCommand( | ||
useCaseIn.memberId, | ||
useCaseIn.time, | ||
it | ||
) | ||
) | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...main/kotlin/com/few/api/domain/subscription/usecase/dto/UpdateSubscriptionDayUseCaseIn.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.few.api.domain.subscription.usecase.dto | ||
|
||
import com.few.api.web.support.DayCode | ||
|
||
data class UpdateSubscriptionDayUseCaseIn( | ||
val memberId: Long, | ||
val dayCode: DayCode, | ||
val workbookId: Long?, | ||
) |
9 changes: 9 additions & 0 deletions
9
...ain/kotlin/com/few/api/domain/subscription/usecase/dto/UpdateSubscriptionTimeUseCaseIn.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.few.api.domain.subscription.usecase.dto | ||
|
||
import java.time.LocalTime | ||
|
||
data class UpdateSubscriptionTimeUseCaseIn( | ||
val memberId: Long, | ||
val time: LocalTime, | ||
val workbookId: Long?, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...in/kotlin/com/few/api/web/controller/subscription/request/UpdateSubscriptionDayRequest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.few.api.web.controller.subscription.request | ||
|
||
data class UpdateSubscriptionDayRequest( | ||
val dayCode: String, | ||
val workbookId: Long?, | ||
) |
8 changes: 8 additions & 0 deletions
8
...n/kotlin/com/few/api/web/controller/subscription/request/UpdateSubscriptionTimeRequest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.few.api.web.controller.subscription.request | ||
|
||
import java.time.LocalTime | ||
|
||
data class UpdateSubscriptionTimeRequest( | ||
val time: LocalTime, | ||
val workbookId: Long?, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
data/db/migration/entity/V1.00.0.23__add_subscription_modified_at.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- 구독 정보 수정 시간을 추가합니다. | ||
ALTER TABLE SUBSCRIPTION ADD COLUMN modified_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP; |