core/core/api/src/commonMain/kotlin/dev/inmo/postssystem/core/content/api/business/content_adapters/text/TextBusinessContentRepoCont...

15 lines
651 B
Kotlin

package dev.inmo.postssystem.core.content.api.business.content_adapters.text
import dev.inmo.micro_utils.repos.*
import dev.inmo.postssystem.core.content.ContentId
import dev.inmo.postssystem.core.content.api.business.BusinessContentRepoContentAdapter
import dev.inmo.postssystem.core.content.api.business.content_adapters.KeyValueBusinessContentRepoAdapter
class TextBusinessContentRepoContentAdapter(
private val keyValueRepo: StandardKeyValueRepo<ContentId, String>
) : BusinessContentRepoContentAdapter by KeyValueBusinessContentRepoAdapter(
"regularText",
keyValueRepo,
{ (it as? TextContent) ?.text },
{ TextContent(it) }
)