core/core/api/src/commonMain/kotlin/dev/inmo/postssystem/core/post/repo/WritePostsRepo.kt

22 lines
806 B
Kotlin

package dev.inmo.postssystem.core.post.repo
import dev.inmo.postssystem.core.post.*
import kotlinx.coroutines.flow.Flow
interface WritePostsRepo {
val postCreatedFlow: Flow<RegisteredPost>
val postDeletedFlow: Flow<RegisteredPost>
val postUpdatedFlow: Flow<RegisteredPost>
/**
* For creating of post you need to create all its [dev.inmo.postssystem.core.content.RegisteredContent]
* and (or just) retrieve their [ContentIds] and put it into some [Post] implementation line [SimplePost].
*
* This method SHOULD use [PostId] of [RegisteredPost.id] in case if [RegisteredPost] passed
*/
suspend fun createPost(post: Post): RegisteredPost?
suspend fun deletePost(id: PostId): Boolean
suspend fun updatePostContent(postId: PostId, post: Post): Boolean
}