Skip to content

Commit

Permalink
fix: add transactionWithResult when updateUser and return select changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandreferris committed Feb 2, 2024
1 parent c487237 commit ec37231
Showing 1 changed file with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<PartialUserEntity>) = withContext(queriesContext) {
Expand Down

0 comments on commit ec37231

Please sign in to comment.