From cb3b726f8109e56077ff6fe63368cae49acfa1e8 Mon Sep 17 00:00:00 2001 From: Vincent TE Date: Tue, 19 Nov 2024 10:14:11 +0100 Subject: [PATCH] fix: Fix delete of transfer --- .../database/controllers/TransferController.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/controllers/TransferController.kt b/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/controllers/TransferController.kt index 8e70d59b..3d5bb1de 100644 --- a/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/controllers/TransferController.kt +++ b/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/controllers/TransferController.kt @@ -32,7 +32,6 @@ import io.realm.kotlin.query.RealmResults import io.realm.kotlin.query.RealmSingleQuery import io.realm.kotlin.query.Sort import io.realm.kotlin.query.TRUE_PREDICATE -import io.realm.kotlin.types.RealmUUID import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.mapLatest @@ -99,8 +98,8 @@ class TransferController(private val realmProvider: RealmProvider) { @Throws(RealmException::class, CancellationException::class) suspend fun deleteTransfer(transferUUID: String) = runThrowingRealm { realm.write { - val transferToDelete = getTransferQuery(realm, transferUUID) - delete(transferToDelete) + val transferToDelete = query("${TransferDB::linkUUID.name} == '$transferUUID'").first() + this.delete(transferToDelete) } }