add integration with posts creating

This commit is contained in:
2022-01-22 13:30:49 +06:00
parent d1fa0242fa
commit 5e61c2a770
22 changed files with 548 additions and 43 deletions

View File

@@ -12,6 +12,8 @@ kotlin {
dependencies {
api project(":postssystem.features.common.common")
api project(":postssystem.features.posts.common")
api "dev.inmo:micro_utils.repos.common:$microutils_version"
api "dev.inmo:micro_utils.repos.ktor.client:$microutils_version"
}
}
}

View File

@@ -1,3 +1,5 @@
package dev.inmo.postssystem.services.posts.common
const val postsRootPath = "posts"
const val postsPostIdParameter = "postId"

View File

@@ -0,0 +1,9 @@
package dev.inmo.postssystem.services.posts.common
import dev.inmo.postssystem.features.content.common.Content
import kotlinx.serialization.Serializable
@Serializable
data class FullNewPost(
val content: List<Content>
)

View File

@@ -0,0 +1,3 @@
package dev.inmo.postssystem.services.posts.common
interface PostsService : ReadPostsService, WritePostsService

View File

@@ -0,0 +1,7 @@
package dev.inmo.postssystem.services.posts.common
import dev.inmo.micro_utils.repos.ReadCRUDRepo
import dev.inmo.postssystem.features.posts.common.PostId
import dev.inmo.postssystem.features.posts.common.RegisteredPost
interface ReadPostsService : ReadCRUDRepo<RegisteredPost, PostId>

View File

@@ -0,0 +1,16 @@
package dev.inmo.postssystem.services.posts.common
import dev.inmo.micro_utils.common.Either
import dev.inmo.postssystem.features.content.common.Content
import dev.inmo.postssystem.features.content.common.ContentId
import dev.inmo.postssystem.features.posts.common.PostId
import dev.inmo.postssystem.features.posts.common.RegisteredPost
interface WritePostsService {
suspend fun create(newPost: FullNewPost): RegisteredPost?
suspend fun update(
postId: PostId,
content: List<Either<ContentId, Content>>
): RegisteredPost?
suspend fun remove(postId: PostId)
}