Skip to content

Commit

Permalink
Merge pull request #590 from walt-id/fix-transaction-in-did-listing
Browse files Browse the repository at this point in the history
Fix transaction block in did listing
  • Loading branch information
SuperBatata committed Jul 8, 2024
2 parents d344e24 + be7bb62 commit 04d36ec
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ class SSIKit2WalletService(
return result.did
}

override suspend fun listDids() = transaction { DidsService.list(walletId) }
override suspend fun listDids() = DidsService.list(walletId)

override suspend fun loadDid(did: String): JsonObject =
DidsService.get(walletId, did)?.let { Json.parseToJsonElement(it.document).jsonObject }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ object DidsService {
.singleOrNull()?.let { WalletDid(it) }
}

fun list(wallet: UUID): List<WalletDid> = WalletDids.selectAll().where { WalletDids.wallet eq wallet }.map { WalletDid(it) }
fun list(wallet: UUID): List<WalletDid> =
transaction { WalletDids.selectAll().where { WalletDids.wallet eq wallet }.map { WalletDid(it) } }

fun getWalletsForDid(did: String): List<UUID> = transaction {
WalletDids.selectAll().where { WalletDids.did eq did }.map {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import io.ktor.server.application.*
import io.ktor.server.response.*
import kotlinx.coroutines.runBlocking
import kotlinx.serialization.json.JsonObject
import org.jetbrains.exposed.sql.transactions.transaction

fun Application.dids() = walletRoute {
route("dids", {
Expand All @@ -26,7 +25,7 @@ fun Application.dids() = walletRoute {
}
}
}) {
context.respond(getWalletService().run { transaction { runBlocking { listDids() } } })
context.respond(getWalletService().run { runBlocking { listDids() } })
}

route("{did}", {
Expand Down

0 comments on commit 04d36ec

Please sign in to comment.