Restrict raw database access to the data module

app no longer touches the database directly. Backup restore's queries move into a new RestoreRepository in :data, which restores a batch of entries all or nothing, stopping between entries if cancelled, as before. The remaining direct calls (excluded scanlators, clear database, backup creation, store and category restore) go through their repositories, and the database bindings move from AppBindings into :data.
This commit is contained in:
AntsyLich
2026-09-27 22:30:51 +06:00
parent a4abb6292b
commit 306befb214
29 changed files with 580 additions and 607 deletions
@@ -1,5 +1,6 @@
package mihon.core.common.extensions
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonObject
val JsonObjectEmpty = JsonObject(emptyMap())
@@ -8,3 +9,7 @@ val JsonObjectEmptyBytes = byteArrayOf(0x7B, 0x7D)
val JsonObject.Companion.EMPTY: JsonObject
inline get() = JsonObjectEmpty
fun JsonObject.toByteArray(): ByteArray = toString().encodeToByteArray()
fun ByteArray.toJsonObject(): JsonObject = Json.decodeFromString<JsonObject>(decodeToString())