From 0fba9455928b12107c6a8866593dcc9037386318 Mon Sep 17 00:00:00 2001 From: belljun3395 <195850@jnu.ac.kr> Date: Mon, 1 Jul 2024 21:50:11 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20WorkbookSubscriptionEvent=20=EB=B0=9C?= =?UTF-8?q?=ED=96=89=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/subscription/usecase/SubscribeWorkbookUseCase.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/api/src/main/kotlin/com/few/api/domain/subscription/usecase/SubscribeWorkbookUseCase.kt b/api/src/main/kotlin/com/few/api/domain/subscription/usecase/SubscribeWorkbookUseCase.kt index f91c76c4e..e9297667d 100644 --- a/api/src/main/kotlin/com/few/api/domain/subscription/usecase/SubscribeWorkbookUseCase.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/usecase/SubscribeWorkbookUseCase.kt @@ -1,5 +1,6 @@ package com.few.api.domain.subscription.usecase +import com.few.api.domain.subscription.event.dto.WorkbookSubscriptionEvent import com.few.api.domain.subscription.service.MemberService import com.few.api.domain.subscription.service.dto.InsertMemberDto import com.few.api.domain.subscription.service.dto.ReadMemberIdDto @@ -9,13 +10,15 @@ import com.few.api.repo.dao.subscription.query.SelectAllWorkbookSubscriptionStat import com.few.api.domain.subscription.usecase.`in`.SubscribeWorkbookUseCaseIn import com.few.api.repo.dao.subscription.query.CountWorkbookMappedArticlesQuery import com.few.data.common.code.MemberType +import org.springframework.context.ApplicationEventPublisher import org.springframework.stereotype.Component import org.springframework.transaction.annotation.Transactional @Component class SubscribeWorkbookUseCase( private val subscriptionDao: SubscriptionDao, - private val memberService: MemberService + private val memberService: MemberService, + private val applicationEventPublisher: ApplicationEventPublisher ) { // todo 이미 가입된 경우 @@ -58,6 +61,7 @@ class SubscribeWorkbookUseCase( /** 구독한 경우가 없는 경우 */ subscriptionDao.insertWorkbookSubscription(command) } + applicationEventPublisher.publishEvent(WorkbookSubscriptionEvent(workbookId = subTargetWorkbookId)) } } }