From 1dfc2251336ac4c56ed02770d1095038fb8e3eeb Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 23 Nov 2019 21:20:14 +0600 Subject: [PATCH] Replace flows due to their logical placement in aggregator of read and write interfaces --- .../insanusmokrassar/postssystem/core/content/Content.kt | 3 +-- .../postssystem/core/content/api/ContentAPI.kt | 8 +++++++- .../postssystem/core/content/api/WriteContentAPI.kt | 4 ---- .../postssystem/core/post/api/PostsAPI.kt | 9 ++++++++- .../postssystem/core/post/api/WritePostsAPI.kt | 5 ----- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/postssystem.core/src/commonMain/kotlin/com/insanusmokrassar/postssystem/core/content/Content.kt b/postssystem.core/src/commonMain/kotlin/com/insanusmokrassar/postssystem/core/content/Content.kt index 958d60ac..f3bacd77 100644 --- a/postssystem.core/src/commonMain/kotlin/com/insanusmokrassar/postssystem/core/content/Content.kt +++ b/postssystem.core/src/commonMain/kotlin/com/insanusmokrassar/postssystem/core/content/Content.kt @@ -1,7 +1,6 @@ package com.insanusmokrassar.postssystem.core.content -import kotlinx.serialization.* -import kotlinx.serialization.internal.* +import kotlinx.serialization.Serializable typealias ContentId = String diff --git a/postssystem.core/src/commonMain/kotlin/com/insanusmokrassar/postssystem/core/content/api/ContentAPI.kt b/postssystem.core/src/commonMain/kotlin/com/insanusmokrassar/postssystem/core/content/api/ContentAPI.kt index c1e6aa17..2c970c2e 100644 --- a/postssystem.core/src/commonMain/kotlin/com/insanusmokrassar/postssystem/core/content/api/ContentAPI.kt +++ b/postssystem.core/src/commonMain/kotlin/com/insanusmokrassar/postssystem/core/content/api/ContentAPI.kt @@ -1,3 +1,9 @@ package com.insanusmokrassar.postssystem.core.content.api -interface ContentAPI : ReadContentAPI, WriteContentAPI +import com.insanusmokrassar.postssystem.core.content.RegisteredContent +import kotlinx.coroutines.flow.Flow + +interface ContentAPI : ReadContentAPI, WriteContentAPI { + val contentCreatedFlow: Flow + val contentDeletedFlow: Flow +} diff --git a/postssystem.core/src/commonMain/kotlin/com/insanusmokrassar/postssystem/core/content/api/WriteContentAPI.kt b/postssystem.core/src/commonMain/kotlin/com/insanusmokrassar/postssystem/core/content/api/WriteContentAPI.kt index 213f1a51..ab9b4d74 100644 --- a/postssystem.core/src/commonMain/kotlin/com/insanusmokrassar/postssystem/core/content/api/WriteContentAPI.kt +++ b/postssystem.core/src/commonMain/kotlin/com/insanusmokrassar/postssystem/core/content/api/WriteContentAPI.kt @@ -1,12 +1,8 @@ package com.insanusmokrassar.postssystem.core.content.api import com.insanusmokrassar.postssystem.core.content.* -import kotlinx.coroutines.flow.Flow interface WriteContentAPI { - val contentCreatedFlow: Flow - val contentDeletedFlow: Flow - suspend fun createContent(content: Content): RegisteredContent? suspend fun deleteContent(id: ContentId): Boolean } diff --git a/postssystem.core/src/commonMain/kotlin/com/insanusmokrassar/postssystem/core/post/api/PostsAPI.kt b/postssystem.core/src/commonMain/kotlin/com/insanusmokrassar/postssystem/core/post/api/PostsAPI.kt index a3fdceea..123184d5 100644 --- a/postssystem.core/src/commonMain/kotlin/com/insanusmokrassar/postssystem/core/post/api/PostsAPI.kt +++ b/postssystem.core/src/commonMain/kotlin/com/insanusmokrassar/postssystem/core/post/api/PostsAPI.kt @@ -1,3 +1,10 @@ package com.insanusmokrassar.postssystem.core.post.api -interface PostsAPI : ReadPostsAPI, WritePostsAPI +import com.insanusmokrassar.postssystem.core.post.RegisteredPost +import kotlinx.coroutines.flow.Flow + +interface PostsAPI : ReadPostsAPI, WritePostsAPI { + val postCreatedFlow: Flow + val postDeletedFlow: Flow + val postUpdatedFlow: Flow +} diff --git a/postssystem.core/src/commonMain/kotlin/com/insanusmokrassar/postssystem/core/post/api/WritePostsAPI.kt b/postssystem.core/src/commonMain/kotlin/com/insanusmokrassar/postssystem/core/post/api/WritePostsAPI.kt index 4d8c0b87..d1cecb91 100644 --- a/postssystem.core/src/commonMain/kotlin/com/insanusmokrassar/postssystem/core/post/api/WritePostsAPI.kt +++ b/postssystem.core/src/commonMain/kotlin/com/insanusmokrassar/postssystem/core/post/api/WritePostsAPI.kt @@ -1,13 +1,8 @@ package com.insanusmokrassar.postssystem.core.post.api import com.insanusmokrassar.postssystem.core.post.* -import kotlinx.coroutines.flow.Flow interface WritePostsAPI { - val postCreatedFlow: Flow - val postDeletedFlow: Flow - val postUpdatedFlow: Flow - /** * For creating of post you need to create all its [com.insanusmokrassar.postssystem.core.content.RegisteredContent] * and (or just) retrieve their [ContentIds] and put it into some [Post] implementation line [SimplePost]