small refactoring
This commit is contained in:
parent
f685175285
commit
4986bed5bc
@ -11,8 +11,8 @@ import kotlinx.serialization.json.Json
|
||||
private val format = Json { ignoreUnknownKeys = true }
|
||||
|
||||
class BinaryBusinessContentRepoContentAdapter(
|
||||
private val dataStore: KeyValueRepo<String, String>,
|
||||
private val filesStore: KeyValueRepo<String, ByteArray>,
|
||||
private val dataStore: KeyValueRepo<ContentId, String>,
|
||||
private val filesStore: KeyValueRepo<ContentId, ByteArray>,
|
||||
private val removeOnAbsentInOneOfStores: Boolean = false
|
||||
) : BusinessContentRepoContentAdapter {
|
||||
override val type: AdapterType
|
||||
@ -20,7 +20,7 @@ class BinaryBusinessContentRepoContentAdapter(
|
||||
|
||||
override suspend fun storeContent(contentId: ContentId, content: Content): Boolean {
|
||||
(content as? BinaryContent) ?.also {
|
||||
filesStore.set(it.originalFileName, it.dataAllocator())
|
||||
filesStore.set(contentId, it.dataAllocator())
|
||||
dataStore.set(
|
||||
contentId,
|
||||
format.encodeToString(BinaryContent.serializer(), it.copy { ByteArray(0) })
|
||||
|
Loading…
Reference in New Issue
Block a user