From 2d5189ce0a2cbdfe9f60cc74a959653412b12a66 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 20 Sep 2019 13:12:14 +0600 Subject: [PATCH] add mutable posts api --- .../postssystem/core/api/MutablePostsAPI.kt | 15 +++++++++++++++ .../postssystem/core/post/Post.kt | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 src/main/kotlin/com/github/insanusmokrassar/postssystem/core/api/MutablePostsAPI.kt diff --git a/src/main/kotlin/com/github/insanusmokrassar/postssystem/core/api/MutablePostsAPI.kt b/src/main/kotlin/com/github/insanusmokrassar/postssystem/core/api/MutablePostsAPI.kt new file mode 100644 index 00000000..847c527f --- /dev/null +++ b/src/main/kotlin/com/github/insanusmokrassar/postssystem/core/api/MutablePostsAPI.kt @@ -0,0 +1,15 @@ +package com.github.insanusmokrassar.postssystem.core.api + +import com.github.insanusmokrassar.postssystem.core.post.* +import kotlinx.coroutines.flow.Flow + +interface MutablePostsAPI { + val postCreatedFlow: Flow + val postDeletedFlow: Flow + val postUpdatedFlow: Flow + + suspend fun createPost(content: PostContents): Post? + suspend fun deletePost(id: PostId): Boolean + + suspend fun updatePostContent(postId: PostId, content: PostContents): Boolean +} \ No newline at end of file diff --git a/src/main/kotlin/com/github/insanusmokrassar/postssystem/core/post/Post.kt b/src/main/kotlin/com/github/insanusmokrassar/postssystem/core/post/Post.kt index 08a0e98f..82588238 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/postssystem/core/post/Post.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/postssystem/core/post/Post.kt @@ -3,10 +3,11 @@ package com.github.insanusmokrassar.postssystem.core.post import com.github.insanusmokrassar.postssystem.core.content.Content typealias PostId = String +typealias PostContents = List interface Post { val id: PostId - val content: List + val content: PostContents val meta: PostMetaInfo } \ No newline at end of file