mirror of https://github.com/usbharu/Hideout.git
feat: init関数を使用して初期化するように
This commit is contained in:
parent
d5805089f5
commit
e2c633a917
|
@ -7,11 +7,10 @@ import org.springframework.stereotype.Component
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
class RegisterLocalUserSetHomeTimelineSubscriber(
|
class RegisterLocalUserSetHomeTimelineSubscriber(
|
||||||
domainEventSubscriber: DomainEventSubscriber,
|
private val domainEventSubscriber: DomainEventSubscriber,
|
||||||
private val userRegisterHomeTimelineApplicationService: UserRegisterHomeTimelineApplicationService
|
private val userRegisterHomeTimelineApplicationService: UserRegisterHomeTimelineApplicationService
|
||||||
) :
|
) : Subscriber {
|
||||||
Subscriber {
|
override fun init() {
|
||||||
init {
|
|
||||||
domainEventSubscriber.subscribe<UserDetailEventBody>(UserDetailEvent.CREATE.eventName) {
|
domainEventSubscriber.subscribe<UserDetailEventBody>(UserDetailEvent.CREATE.eventName) {
|
||||||
userRegisterHomeTimelineApplicationService.execute(
|
userRegisterHomeTimelineApplicationService.execute(
|
||||||
RegisterHomeTimeline(it.body.getUserDetail().id),
|
RegisterHomeTimeline(it.body.getUserDetail().id),
|
||||||
|
@ -19,4 +18,5 @@ class RegisterLocalUserSetHomeTimelineSubscriber(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,11 +9,11 @@ import org.springframework.stereotype.Component
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
class RegisterTimelineSetTimelineStoreSubscriber(
|
class RegisterTimelineSetTimelineStoreSubscriber(
|
||||||
domainEventSubscriber: DomainEventSubscriber,
|
private val domainEventSubscriber: DomainEventSubscriber,
|
||||||
private val setTimelineToTimelineStoreApplicationService: SetTimelineToTimelineStoreApplicationService
|
private val setTimelineToTimelineStoreApplicationService: SetTimelineToTimelineStoreApplicationService
|
||||||
) :
|
) : Subscriber {
|
||||||
Subscriber {
|
|
||||||
init {
|
override fun init() {
|
||||||
domainEventSubscriber.subscribe<TimelineEventBody>(TimelineEvent.CREATE.eventName) {
|
domainEventSubscriber.subscribe<TimelineEventBody>(TimelineEvent.CREATE.eventName) {
|
||||||
setTimelineToTimelineStoreApplicationService.execute(SetTimleineStore(it.body.getTimelineId()), Anonymous)
|
setTimelineToTimelineStoreApplicationService.execute(SetTimleineStore(it.body.getTimelineId()), Anonymous)
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,9 @@ import org.springframework.stereotype.Component
|
||||||
@Component
|
@Component
|
||||||
class TimelinePostCreateSubscriber(
|
class TimelinePostCreateSubscriber(
|
||||||
private val timelineAddPostApplicationService: TimelineAddPostApplicationService,
|
private val timelineAddPostApplicationService: TimelineAddPostApplicationService,
|
||||||
domainEventSubscriber: DomainEventSubscriber,
|
private val domainEventSubscriber: DomainEventSubscriber,
|
||||||
) : Subscriber {
|
) : Subscriber {
|
||||||
init {
|
override fun init() {
|
||||||
domainEventSubscriber.subscribe<PostEventBody>(PostEvent.CREATE.eventName) {
|
domainEventSubscriber.subscribe<PostEventBody>(PostEvent.CREATE.eventName) {
|
||||||
timelineAddPostApplicationService.execute(AddPost(it.body.getPostId()), Anonymous)
|
timelineAddPostApplicationService.execute(AddPost(it.body.getPostId()), Anonymous)
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,10 +18,10 @@ class TimelineRelationshipFollowSubscriber(
|
||||||
private val userAddTimelineRelationshipApplicationService: UserAddTimelineRelationshipApplicationService,
|
private val userAddTimelineRelationshipApplicationService: UserAddTimelineRelationshipApplicationService,
|
||||||
private val idGenerateService: IdGenerateService,
|
private val idGenerateService: IdGenerateService,
|
||||||
private val userDetailRepository: UserDetailRepository,
|
private val userDetailRepository: UserDetailRepository,
|
||||||
domainEventSubscriber: DomainEventSubscriber
|
private val domainEventSubscriber: DomainEventSubscriber
|
||||||
) : Subscriber {
|
) : Subscriber {
|
||||||
|
|
||||||
init {
|
override fun init() {
|
||||||
domainEventSubscriber.subscribe<RelationshipEventBody>(RelationshipEvent.FOLLOW.eventName) {
|
domainEventSubscriber.subscribe<RelationshipEventBody>(RelationshipEvent.FOLLOW.eventName) {
|
||||||
val relationship = it.body.getRelationship()
|
val relationship = it.body.getRelationship()
|
||||||
val userDetail = userDetailRepository.findByActorId(relationship.actorId.id)
|
val userDetail = userDetailRepository.findByActorId(relationship.actorId.id)
|
||||||
|
|
Loading…
Reference in New Issue