From ec3723154434245c123740d85ae05006581a3c55 Mon Sep 17 00:00:00 2001 From: alexandreferris Date: Fri, 2 Feb 2024 11:43:49 +0100 Subject: [PATCH] fix: add transactionWithResult when updateUser and return select changes --- .../kalium/persistence/dao/UserDAOImpl.kt | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/persistence/src/commonMain/kotlin/com/wire/kalium/persistence/dao/UserDAOImpl.kt b/persistence/src/commonMain/kotlin/com/wire/kalium/persistence/dao/UserDAOImpl.kt index 118fd6c10de..6e32681adf6 100644 --- a/persistence/src/commonMain/kotlin/com/wire/kalium/persistence/dao/UserDAOImpl.kt +++ b/persistence/src/commonMain/kotlin/com/wire/kalium/persistence/dao/UserDAOImpl.kt @@ -193,16 +193,19 @@ class UserDAOImpl internal constructor( } override suspend fun updateUser(update: PartialUserEntity) = withContext(queriesContext) { - userQueries.updateUser( - name = update.name, - handle = update.handle, - email = update.email, - accent_id = update.accentId?.toLong(), - preview_asset_id = update.previewAssetId, - complete_asset_id = update.completeAssetId, - supported_protocols = update.supportedProtocols, - update.id - ).executeAsOne() > 0 + userQueries.transactionWithResult { + userQueries.updateUser( + name = update.name, + handle = update.handle, + email = update.email, + accent_id = update.accentId?.toLong(), + preview_asset_id = update.previewAssetId, + complete_asset_id = update.completeAssetId, + supported_protocols = update.supportedProtocols, + update.id + ) + userQueries.selectChanges().executeAsOne() > 0 + } } override suspend fun updateUser(users: List) = withContext(queriesContext) {