From 277d978f9e4d8906a46c8a9e77831a49d6f1c221 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 15 Aug 2020 14:23:30 +0600 Subject: [PATCH] add published posts repo triggering from publishing trigger --- .../postssystem/core/publishing/PublishingTrigger.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/publishing/api/src/commonMain/kotlin/com/insanusmokrassar/postssystem/core/publishing/PublishingTrigger.kt b/publishing/api/src/commonMain/kotlin/com/insanusmokrassar/postssystem/core/publishing/PublishingTrigger.kt index f502a62d..8c9d3605 100644 --- a/publishing/api/src/commonMain/kotlin/com/insanusmokrassar/postssystem/core/publishing/PublishingTrigger.kt +++ b/publishing/api/src/commonMain/kotlin/com/insanusmokrassar/postssystem/core/publishing/PublishingTrigger.kt @@ -3,6 +3,7 @@ package com.insanusmokrassar.postssystem.core.publishing import com.insanusmokrassar.postssystem.core.post.PostId import com.insanusmokrassar.postssystem.core.post.RegisteredPost import com.insanusmokrassar.postssystem.core.post.repo.PostsRepo +import com.insanusmokrassar.postssystem.core.post.repo.WritePostsRepo import com.insanusmokrassar.postssystem.core.publishing.repos.PublishingKeysRepo import kotlinx.coroutines.channels.BroadcastChannel import kotlinx.coroutines.channels.Channel @@ -19,6 +20,7 @@ interface PublishingTrigger { class BusinessPublishingTrigger( private val postsRepo: PostsRepo, + private val publishedPostsRepo: WritePostsRepo, private val publishingKeysRepo: PublishingKeysRepo ) : PublishingTrigger { private val postingTriggeredChannel: BroadcastChannel = BroadcastChannel(Channel.BUFFERED) @@ -30,6 +32,7 @@ class BusinessPublishingTrigger( return postsRepo.getPostById(postId) ?.let { post -> if (postsRepo.deletePost(postId)) { + publishedPostsRepo.createPost(post) postingTriggeredChannel.send(post) postId } else {