rewrite posts api to be result of write and read posts apis
This commit is contained in:
parent
9c1bffab41
commit
71c7880582
@ -1,15 +1,3 @@
|
||||
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 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>
|
||||
}
|
||||
interface PostsAPI : ReadPostsAPI, WritePostsAPI
|
||||
|
@ -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>
|
||||
}
|
@ -3,7 +3,7 @@ package com.github.insanusmokrassar.postssystem.core.api
|
||||
import com.github.insanusmokrassar.postssystem.core.post.*
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
interface MutablePostsAPI {
|
||||
interface WritePostsAPI {
|
||||
val postCreatedFlow: Flow<Post>
|
||||
val postDeletedFlow: Flow<Post>
|
||||
val postUpdatedFlow: Flow<Post>
|
Loading…
Reference in New Issue
Block a user