From 7a5fd177c8d4f7578ff45755f83c21981a41a0c5 Mon Sep 17 00:00:00 2001 From: Mikhail Astafyev Date: Mon, 4 Nov 2019 15:00:42 +0500 Subject: [PATCH 1/5] PSC-2 added test implementation for ContentAPI --- .../core/content/api/WriteContentAPI.kt | 6 +- .../postssystem/core/utils/DateTimeUtils.kt | 9 +++ .../core/utils/pagination/Pagination.kt | 9 +++ .../core/api/InMemoryContentAPI.kt | 67 +++++++++++++++++++ 4 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 core/src/main/kotlin/com/insanusmokrassar/postssystem/core/utils/DateTimeUtils.kt create mode 100644 core/src/test/kotlin/com/insanusmokrassar/postssystem/core/api/InMemoryContentAPI.kt diff --git a/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/content/api/WriteContentAPI.kt b/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/content/api/WriteContentAPI.kt index 3fbad021..acda8975 100644 --- a/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/content/api/WriteContentAPI.kt +++ b/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/content/api/WriteContentAPI.kt @@ -1,12 +1,14 @@ package com.insanusmokrassar.postssystem.core.content.api -import com.insanusmokrassar.postssystem.core.content.* +import com.insanusmokrassar.postssystem.core.content.Content +import com.insanusmokrassar.postssystem.core.content.ContentId +import com.insanusmokrassar.postssystem.core.content.RegisteredContent import kotlinx.coroutines.flow.Flow interface WriteContentAPI { val contentCreatedFlow: Flow val contentDeletedFlow: Flow - suspend fun createContent(post: Content): RegisteredContent? + suspend fun createContent(content: Content): RegisteredContent? suspend fun deleteContent(id: ContentId): Boolean } diff --git a/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/utils/DateTimeUtils.kt b/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/utils/DateTimeUtils.kt new file mode 100644 index 00000000..3beef0cd --- /dev/null +++ b/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/utils/DateTimeUtils.kt @@ -0,0 +1,9 @@ +package com.insanusmokrassar.postssystem.core.utils + +import org.joda.time.DateTime + +fun DateTime?.orMin(): DateTime = this ?: MIN_DATE +fun DateTime?.orMax(): DateTime = this ?: MAX_DATE + +private val MIN_DATE = DateTime(Long.MIN_VALUE) +private val MAX_DATE = DateTime(Long.MAX_VALUE) diff --git a/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/utils/pagination/Pagination.kt b/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/utils/pagination/Pagination.kt index a8496b9d..c58d4953 100644 --- a/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/utils/pagination/Pagination.kt +++ b/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/utils/pagination/Pagination.kt @@ -1,5 +1,7 @@ package com.insanusmokrassar.postssystem.core.utils.pagination +import kotlin.math.ceil + /** * Base interface of pagination * @@ -33,3 +35,10 @@ val Pagination.firstIndex: Int */ val Pagination.lastIndex: Int get() = firstIndex + size - 1 + +/** + * Calculates pages count for given [datasetSize] + */ +fun Pagination.pagesCount(datasetSize: Int): Int { + return ceil(datasetSize.toDouble() / size).toInt() +} diff --git a/core/src/test/kotlin/com/insanusmokrassar/postssystem/core/api/InMemoryContentAPI.kt b/core/src/test/kotlin/com/insanusmokrassar/postssystem/core/api/InMemoryContentAPI.kt new file mode 100644 index 00000000..795db98d --- /dev/null +++ b/core/src/test/kotlin/com/insanusmokrassar/postssystem/core/api/InMemoryContentAPI.kt @@ -0,0 +1,67 @@ +package com.insanusmokrassar.postssystem.core.api + +import com.insanusmokrassar.postssystem.core.content.* +import com.insanusmokrassar.postssystem.core.content.api.ContentAPI +import com.insanusmokrassar.postssystem.core.utils.pagination.Pagination +import com.insanusmokrassar.postssystem.core.utils.pagination.PaginationResult +import com.insanusmokrassar.postssystem.core.utils.pagination.firstIndex +import com.insanusmokrassar.postssystem.core.utils.pagination.pagesCount +import kotlinx.coroutines.channels.BroadcastChannel +import kotlinx.coroutines.channels.Channel +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.asFlow +import kotlinx.serialization.ImplicitReflectionSerializer +import java.util.* + +@ImplicitReflectionSerializer +private fun generateId(): ContentId = UUID.randomUUID().toString() + +@ImplicitReflectionSerializer +class InMemoryContentAPI( + initialContent: List = emptyList() +): ContentAPI { + + override val contentCreatedFlow: Flow + get() = contentCreatedBroadcastChannel.asFlow() + + override val contentDeletedFlow: Flow + get() = contentDeletedBroadcastChannel.asFlow() + + private val contents: MutableMap = initialContent + .associateBy(RegisteredContent::id) + .toMutableMap() + + private val contentCreatedBroadcastChannel = BroadcastChannel(Channel.BUFFERED) + private val contentDeletedBroadcastChannel = BroadcastChannel(Channel.BUFFERED) + + override suspend fun createContent(content: Content): RegisteredContent? { + return content.createRegisteredEntity(generateId())?.also { registeredContent -> + contents[registeredContent.id] = registeredContent + contentCreatedBroadcastChannel.send(registeredContent) + } + } + + override suspend fun getContentById(id: ContentId): RegisteredContent? = contents[id] + + override suspend fun getContentByPagination(pagination: Pagination): PaginationResult { + return PaginationResult( + page = pagination.page, + pagesNumber = pagination.pagesCount(contents.size), + results = contents.values.drop(pagination.firstIndex).take(pagination.size) + ) + } + + override suspend fun deleteContent(id: ContentId): Boolean { + return contents.remove(id)?.also { content -> + contentDeletedBroadcastChannel.send(content) + } != null + } + + private fun Content.createRegisteredEntity(id: ContentId): RegisteredContent? { + return when(this) { + is TextContent -> SimpleTextRegisteredContent(id, text) + is SpecialContent -> SimpleTextRegisteredContent(id, internalId) + else -> null + } + } +} \ No newline at end of file From f2d66b2fe98ce355ba355914b126230c81597e39 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 4 Nov 2019 20:35:24 +0600 Subject: [PATCH 2/5] small refactoring --- .../core/utils/pagination/Pagination.kt | 9 +++++++-- .../core/utils/pagination/PaginationResult.kt | 17 ++++++++++++----- .../postssystem/core/api/InMemoryContentAPI.kt | 17 ++++++----------- 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/utils/pagination/Pagination.kt b/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/utils/pagination/Pagination.kt index c58d4953..c904b3ce 100644 --- a/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/utils/pagination/Pagination.kt +++ b/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/utils/pagination/Pagination.kt @@ -39,6 +39,11 @@ val Pagination.lastIndex: Int /** * Calculates pages count for given [datasetSize] */ -fun Pagination.pagesCount(datasetSize: Int): Int { - return ceil(datasetSize.toDouble() / size).toInt() +fun calculatePagesNumber(datasetSize: Int, pageSize: Int): Int { + return ceil(datasetSize.toDouble() / pageSize).toInt() } + +/** + * Calculates pages count for given [datasetSize] + */ +inline fun Pagination.calculatePagesNumber(datasetSize: Int): Int = calculatePagesNumber(datasetSize, size) diff --git a/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/utils/pagination/PaginationResult.kt b/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/utils/pagination/PaginationResult.kt index 67f3e855..9808f22d 100644 --- a/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/utils/pagination/PaginationResult.kt +++ b/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/utils/pagination/PaginationResult.kt @@ -1,14 +1,21 @@ package com.insanusmokrassar.postssystem.core.utils.pagination import kotlinx.serialization.Serializable -import kotlinx.serialization.Transient @Serializable data class PaginationResult( override val page: Int, val pagesNumber: Int, - val results: List -) : Pagination { - @Transient + val results: List, override val size: Int = results.size -} +) : Pagination + +fun Pagination.createResult( + commonObjectsNumber: Int, + results: List +) = PaginationResult( + page, + calculatePagesNumber(commonObjectsNumber), + results, + size +) diff --git a/core/src/test/kotlin/com/insanusmokrassar/postssystem/core/api/InMemoryContentAPI.kt b/core/src/test/kotlin/com/insanusmokrassar/postssystem/core/api/InMemoryContentAPI.kt index 795db98d..00c101dc 100644 --- a/core/src/test/kotlin/com/insanusmokrassar/postssystem/core/api/InMemoryContentAPI.kt +++ b/core/src/test/kotlin/com/insanusmokrassar/postssystem/core/api/InMemoryContentAPI.kt @@ -2,10 +2,7 @@ package com.insanusmokrassar.postssystem.core.api import com.insanusmokrassar.postssystem.core.content.* import com.insanusmokrassar.postssystem.core.content.api.ContentAPI -import com.insanusmokrassar.postssystem.core.utils.pagination.Pagination -import com.insanusmokrassar.postssystem.core.utils.pagination.PaginationResult -import com.insanusmokrassar.postssystem.core.utils.pagination.firstIndex -import com.insanusmokrassar.postssystem.core.utils.pagination.pagesCount +import com.insanusmokrassar.postssystem.core.utils.pagination.* import kotlinx.coroutines.channels.BroadcastChannel import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.flow.Flow @@ -20,6 +17,8 @@ private fun generateId(): ContentId = UUID.randomUUID().toString() class InMemoryContentAPI( initialContent: List = emptyList() ): ContentAPI { + private val contentCreatedBroadcastChannel = BroadcastChannel(Channel.BUFFERED) + private val contentDeletedBroadcastChannel = BroadcastChannel(Channel.BUFFERED) override val contentCreatedFlow: Flow get() = contentCreatedBroadcastChannel.asFlow() @@ -31,9 +30,6 @@ class InMemoryContentAPI( .associateBy(RegisteredContent::id) .toMutableMap() - private val contentCreatedBroadcastChannel = BroadcastChannel(Channel.BUFFERED) - private val contentDeletedBroadcastChannel = BroadcastChannel(Channel.BUFFERED) - override suspend fun createContent(content: Content): RegisteredContent? { return content.createRegisteredEntity(generateId())?.also { registeredContent -> contents[registeredContent.id] = registeredContent @@ -44,10 +40,9 @@ class InMemoryContentAPI( override suspend fun getContentById(id: ContentId): RegisteredContent? = contents[id] override suspend fun getContentByPagination(pagination: Pagination): PaginationResult { - return PaginationResult( - page = pagination.page, - pagesNumber = pagination.pagesCount(contents.size), - results = contents.values.drop(pagination.firstIndex).take(pagination.size) + return pagination.createResult( + commonObjectsNumber = contents.size, + results = contents.values.asSequence().drop(pagination.firstIndex).take(pagination.size).toList() ) } From 5017e66dadeb7415e7c0d8611de641a7b0987028 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 4 Nov 2019 20:41:52 +0600 Subject: [PATCH 3/5] temporary remove @Serializable annotation from PaginationResult --- .../postssystem/core/content/Content.kt | 21 ++++++++++--- .../core/content/SpecialContent.kt | 31 ------------------- .../postssystem/core/content/TextContent.kt | 20 ------------ .../postssystem/core/utils/IdUtils.kt | 2 ++ .../core/utils/pagination/PaginationResult.kt | 1 - .../core/api/InMemoryContentAPI.kt | 13 +++----- 6 files changed, 23 insertions(+), 65 deletions(-) delete mode 100644 core/src/main/kotlin/com/insanusmokrassar/postssystem/core/content/SpecialContent.kt delete mode 100644 core/src/main/kotlin/com/insanusmokrassar/postssystem/core/content/TextContent.kt create mode 100644 core/src/main/kotlin/com/insanusmokrassar/postssystem/core/utils/IdUtils.kt diff --git a/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/content/Content.kt b/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/content/Content.kt index c21ffb42..55f08b41 100644 --- a/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/content/Content.kt +++ b/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/content/Content.kt @@ -1,17 +1,30 @@ package com.insanusmokrassar.postssystem.core.content +import kotlinx.serialization.Serializable + typealias ContentId = String /** * Content which is planned to be registered in database */ -interface Content +sealed class Content + +@Serializable +data class SimpleSpecialContent( + val internalId: ContentId +) : Content() + +@Serializable +data class SimpleTextContent( + val text: String +) : Content() /** * Content which is already registered in database. Using its [id] you can retrieve all known * [com.insanusmokrassar.postssystem.core.post.RegisteredPost]s by using * [com.insanusmokrassar.postssystem.core.post.api.ReadPostsAPI.getPostsByContent] */ -interface RegisteredContent : Content { - val id: ContentId -} +data class RegisteredContent( + val id: ContentId, + val content: Content +) diff --git a/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/content/SpecialContent.kt b/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/content/SpecialContent.kt deleted file mode 100644 index f4100390..00000000 --- a/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/content/SpecialContent.kt +++ /dev/null @@ -1,31 +0,0 @@ -package com.insanusmokrassar.postssystem.core.content - -import kotlinx.serialization.Serializable - -/** - * Special content, which usually better known in some plugin or system, but is not representable in others. For - * example, it could be issue in some git system, which is unknown for all other systems. - * - * @property internalId Represent Id of this content in system which knows exact type and can correctly handle this - * content - */ -interface SpecialContent : Content { - val internalId: ContentId -} - -/** - * As [SpecialContent], but already registered in posts system - */ -interface SpecialRegisteredContent : RegisteredContent, SpecialContent - -@Serializable -data class SimpleSpecialContent( - override val internalId: ContentId -) : SpecialContent - -@Serializable -data class SimpleSpecialRegisteredContent( - override val id: ContentId, - override val internalId: ContentId -) : SpecialRegisteredContent - diff --git a/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/content/TextContent.kt b/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/content/TextContent.kt deleted file mode 100644 index af2608e6..00000000 --- a/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/content/TextContent.kt +++ /dev/null @@ -1,20 +0,0 @@ -package com.insanusmokrassar.postssystem.core.content - -import kotlinx.serialization.Serializable - -interface TextContent : Content { - val text: String -} - -interface TextRegisteredContent : RegisteredContent, TextContent - -@Serializable -data class SimpleTextContent( - override val text: String -) : TextContent - -@Serializable -data class SimpleTextRegisteredContent( - override val id: ContentId, - override val text: String -) : TextRegisteredContent diff --git a/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/utils/IdUtils.kt b/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/utils/IdUtils.kt new file mode 100644 index 00000000..8abc485c --- /dev/null +++ b/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/utils/IdUtils.kt @@ -0,0 +1,2 @@ +package com.insanusmokrassar.postssystem.core.utils + diff --git a/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/utils/pagination/PaginationResult.kt b/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/utils/pagination/PaginationResult.kt index 9808f22d..b7b5e783 100644 --- a/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/utils/pagination/PaginationResult.kt +++ b/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/utils/pagination/PaginationResult.kt @@ -2,7 +2,6 @@ package com.insanusmokrassar.postssystem.core.utils.pagination import kotlinx.serialization.Serializable -@Serializable data class PaginationResult( override val page: Int, val pagesNumber: Int, diff --git a/core/src/test/kotlin/com/insanusmokrassar/postssystem/core/api/InMemoryContentAPI.kt b/core/src/test/kotlin/com/insanusmokrassar/postssystem/core/api/InMemoryContentAPI.kt index 00c101dc..ed0fd2e2 100644 --- a/core/src/test/kotlin/com/insanusmokrassar/postssystem/core/api/InMemoryContentAPI.kt +++ b/core/src/test/kotlin/com/insanusmokrassar/postssystem/core/api/InMemoryContentAPI.kt @@ -31,7 +31,10 @@ class InMemoryContentAPI( .toMutableMap() override suspend fun createContent(content: Content): RegisteredContent? { - return content.createRegisteredEntity(generateId())?.also { registeredContent -> + return RegisteredContent( + generateId(), + content + ).also { registeredContent -> contents[registeredContent.id] = registeredContent contentCreatedBroadcastChannel.send(registeredContent) } @@ -51,12 +54,4 @@ class InMemoryContentAPI( contentDeletedBroadcastChannel.send(content) } != null } - - private fun Content.createRegisteredEntity(id: ContentId): RegisteredContent? { - return when(this) { - is TextContent -> SimpleTextRegisteredContent(id, text) - is SpecialContent -> SimpleTextRegisteredContent(id, internalId) - else -> null - } - } } \ No newline at end of file From 1b9b549208fc7a52bb0586048b732fca9af4d6f0 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 4 Nov 2019 20:44:32 +0600 Subject: [PATCH 4/5] add IdUtils --- .../insanusmokrassar/postssystem/core/utils/IdUtils.kt | 8 ++++++++ .../postssystem/core/api/InMemoryContentAPI.kt | 7 ++----- .../postssystem/core/api/InMemoryPostsAPI.kt | 6 ++---- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/utils/IdUtils.kt b/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/utils/IdUtils.kt index 8abc485c..68c970ba 100644 --- a/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/utils/IdUtils.kt +++ b/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/utils/IdUtils.kt @@ -1,2 +1,10 @@ package com.insanusmokrassar.postssystem.core.utils +import com.insanusmokrassar.postssystem.core.content.ContentId +import com.insanusmokrassar.postssystem.core.post.PostId +import java.util.* + +private fun generateId() = UUID.randomUUID().toString() + +internal fun generatePostId(): PostId = generateId() +internal fun generateContentId(): ContentId = generateId() diff --git a/core/src/test/kotlin/com/insanusmokrassar/postssystem/core/api/InMemoryContentAPI.kt b/core/src/test/kotlin/com/insanusmokrassar/postssystem/core/api/InMemoryContentAPI.kt index ed0fd2e2..87e7fb82 100644 --- a/core/src/test/kotlin/com/insanusmokrassar/postssystem/core/api/InMemoryContentAPI.kt +++ b/core/src/test/kotlin/com/insanusmokrassar/postssystem/core/api/InMemoryContentAPI.kt @@ -2,16 +2,13 @@ package com.insanusmokrassar.postssystem.core.api import com.insanusmokrassar.postssystem.core.content.* import com.insanusmokrassar.postssystem.core.content.api.ContentAPI +import com.insanusmokrassar.postssystem.core.utils.generateContentId import com.insanusmokrassar.postssystem.core.utils.pagination.* import kotlinx.coroutines.channels.BroadcastChannel import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.asFlow import kotlinx.serialization.ImplicitReflectionSerializer -import java.util.* - -@ImplicitReflectionSerializer -private fun generateId(): ContentId = UUID.randomUUID().toString() @ImplicitReflectionSerializer class InMemoryContentAPI( @@ -32,7 +29,7 @@ class InMemoryContentAPI( override suspend fun createContent(content: Content): RegisteredContent? { return RegisteredContent( - generateId(), + generateContentId(), content ).also { registeredContent -> contents[registeredContent.id] = registeredContent diff --git a/core/src/test/kotlin/com/insanusmokrassar/postssystem/core/api/InMemoryPostsAPI.kt b/core/src/test/kotlin/com/insanusmokrassar/postssystem/core/api/InMemoryPostsAPI.kt index c932a4f4..c9864b21 100644 --- a/core/src/test/kotlin/com/insanusmokrassar/postssystem/core/api/InMemoryPostsAPI.kt +++ b/core/src/test/kotlin/com/insanusmokrassar/postssystem/core/api/InMemoryPostsAPI.kt @@ -3,6 +3,7 @@ package com.insanusmokrassar.postssystem.core.api import com.insanusmokrassar.postssystem.core.content.ContentId import com.insanusmokrassar.postssystem.core.post.* import com.insanusmokrassar.postssystem.core.post.api.PostsAPI +import com.insanusmokrassar.postssystem.core.utils.generatePostId import com.insanusmokrassar.postssystem.core.utils.pagination.* import kotlinx.coroutines.channels.BroadcastChannel import kotlinx.coroutines.channels.Channel.Factory.BUFFERED @@ -12,9 +13,6 @@ import kotlinx.serialization.ImplicitReflectionSerializer import org.joda.time.DateTime import java.util.* -@ImplicitReflectionSerializer -private fun generateId(): PostId = UUID.randomUUID().toString() - /** * Thread-unsafe sample realization of [PostsAPI] */ @@ -39,7 +37,7 @@ class InMemoryPostsAPI( override suspend fun createPost(post: Post): RegisteredPost? { return SimpleRegisteredPost( - generateId(), + generatePostId(), post.content ).also { newPost -> posts[newPost.id] = newPost From c2f5d77fc233e6e9a384b3db6965f4e6b466cdd0 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 4 Nov 2019 20:46:35 +0600 Subject: [PATCH 5/5] optimize imports --- .../postssystem/core/content/api/WriteContentAPI.kt | 4 +--- .../postssystem/core/utils/pagination/PaginationResult.kt | 2 -- .../insanusmokrassar/postssystem/core/api/InMemoryPostsAPI.kt | 1 - 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/content/api/WriteContentAPI.kt b/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/content/api/WriteContentAPI.kt index acda8975..213f1a51 100644 --- a/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/content/api/WriteContentAPI.kt +++ b/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/content/api/WriteContentAPI.kt @@ -1,8 +1,6 @@ package com.insanusmokrassar.postssystem.core.content.api -import com.insanusmokrassar.postssystem.core.content.Content -import com.insanusmokrassar.postssystem.core.content.ContentId -import com.insanusmokrassar.postssystem.core.content.RegisteredContent +import com.insanusmokrassar.postssystem.core.content.* import kotlinx.coroutines.flow.Flow interface WriteContentAPI { diff --git a/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/utils/pagination/PaginationResult.kt b/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/utils/pagination/PaginationResult.kt index b7b5e783..bcff16d9 100644 --- a/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/utils/pagination/PaginationResult.kt +++ b/core/src/main/kotlin/com/insanusmokrassar/postssystem/core/utils/pagination/PaginationResult.kt @@ -1,7 +1,5 @@ package com.insanusmokrassar.postssystem.core.utils.pagination -import kotlinx.serialization.Serializable - data class PaginationResult( override val page: Int, val pagesNumber: Int, diff --git a/core/src/test/kotlin/com/insanusmokrassar/postssystem/core/api/InMemoryPostsAPI.kt b/core/src/test/kotlin/com/insanusmokrassar/postssystem/core/api/InMemoryPostsAPI.kt index c9864b21..c9d5a317 100644 --- a/core/src/test/kotlin/com/insanusmokrassar/postssystem/core/api/InMemoryPostsAPI.kt +++ b/core/src/test/kotlin/com/insanusmokrassar/postssystem/core/api/InMemoryPostsAPI.kt @@ -11,7 +11,6 @@ import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.asFlow import kotlinx.serialization.ImplicitReflectionSerializer import org.joda.time.DateTime -import java.util.* /** * Thread-unsafe sample realization of [PostsAPI]