From ed46c888e32dccd298a961588dd4527f986a6100 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Tue, 1 Dec 2020 12:48:24 +0600 Subject: [PATCH] add including of contents serializers --- .../dev/inmo/postssystem/core/content/Content.kt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/core/api/src/commonMain/kotlin/dev/inmo/postssystem/core/content/Content.kt b/core/api/src/commonMain/kotlin/dev/inmo/postssystem/core/content/Content.kt index 2f54b95a..f3e0f65f 100644 --- a/core/api/src/commonMain/kotlin/dev/inmo/postssystem/core/content/Content.kt +++ b/core/api/src/commonMain/kotlin/dev/inmo/postssystem/core/content/Content.kt @@ -1,10 +1,7 @@ package dev.inmo.postssystem.core.content -import dev.inmo.micro_utils.common.ByteArrayAllocator -import dev.inmo.micro_utils.common.ByteArrayAllocatorSerializer -import dev.inmo.micro_utils.mime_types.KnownMimeTypes -import dev.inmo.micro_utils.mime_types.MimeType import kotlinx.serialization.Serializable +import kotlinx.serialization.modules.* typealias ContentId = String @@ -23,6 +20,14 @@ data class OtherContentLinkContent( ) : Content +fun SerializersModuleBuilder.includeContentsSerializers( + block: PolymorphicModuleBuilder.() -> Unit +) { + polymorphic(Content::class) { + subclass(OtherContentLinkContent::class, OtherContentLinkContent.serializer()) + block() + } +} /** * Content which is already registered in database. Using its [id] you can retrieve all known