rewrite posts api to be result of write and read posts apis

This commit is contained in:
InsanusMokrassar 2019-09-20 13:21:24 +06:00
parent 9c1bffab41
commit 71c7880582
3 changed files with 17 additions and 14 deletions

View File

@ -1,15 +1,3 @@
package com.github.insanusmokrassar.postssystem.core.api package com.github.insanusmokrassar.postssystem.core.api
import com.github.insanusmokrassar.postssystem.core.post.Post interface PostsAPI : ReadPostsAPI, WritePostsAPI
import com.github.insanusmokrassar.postssystem.core.post.PostId
import com.github.insanusmokrassar.postssystem.core.content.ContentId
import com.github.insanusmokrassar.postssystem.core.utils.pagination.*
import org.joda.time.DateTime
interface PostsAPI {
suspend fun getPostById(id: PostId): Post?
suspend fun getPostsByContent(id: ContentId): List<Post>
suspend fun getPostsByDates(from: DateTime? = null, to: DateTime? = null): List<Post>
suspend fun getPostsByPagination(pagination: Pagination): PaginationResult<Post>
}

View File

@ -0,0 +1,15 @@
package com.github.insanusmokrassar.postssystem.core.api
import com.github.insanusmokrassar.postssystem.core.post.Post
import com.github.insanusmokrassar.postssystem.core.post.PostId
import com.github.insanusmokrassar.postssystem.core.content.ContentId
import com.github.insanusmokrassar.postssystem.core.utils.pagination.*
import org.joda.time.DateTime
interface ReadPostsAPI {
suspend fun getPostById(id: PostId): Post?
suspend fun getPostsByContent(id: ContentId): List<Post>
suspend fun getPostsByDates(from: DateTime? = null, to: DateTime? = null): List<Post>
suspend fun getPostsByPagination(pagination: Pagination): PaginationResult<Post>
}

View File

@ -3,7 +3,7 @@ package com.github.insanusmokrassar.postssystem.core.api
import com.github.insanusmokrassar.postssystem.core.post.* import com.github.insanusmokrassar.postssystem.core.post.*
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
interface MutablePostsAPI { interface WritePostsAPI {
val postCreatedFlow: Flow<Post> val postCreatedFlow: Flow<Post>
val postDeletedFlow: Flow<Post> val postDeletedFlow: Flow<Post>
val postUpdatedFlow: Flow<Post> val postUpdatedFlow: Flow<Post>