Skip to content

Commit

Permalink
fix: expect correct type from SQLDelight Account query
Browse files Browse the repository at this point in the history
  • Loading branch information
jcmelati committed Jul 26, 2024
1 parent 9d8ea00 commit 06bfc23
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.sphereon.oid.fed.persistence.repositories
import com.sphereon.oid.fed.openapi.models.Account

import Account.Account
import com.sphereon.oid.fed.persistence.Database

interface AccountRepository {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
package com.sphereon.oid.fed.persistence.repositories

import Account.Account
import Account.AccountQueries
import com.sphereon.oid.fed.persistence.Database
import app.cash.sqldelight.Query
import com.sphereon.oid.fed.openapi.models.Account

private class JvmAccountRepository(database: Database) : AccountRepository {
private val accountQueries: AccountQueries = database.accountQueries

override fun findById(id: Int): Account? {
return accountQueries.findById(id).executeAsOneOrNull()
}

override fun findByUsername(username: String): Account? {
return accountQueries.findByUsername(username).executeAsOneOrNull()
}

override fun create(account: Account) {
accountQueries.create(account.username)
}
}

actual fun AccountRepository(database: Database): AccountRepository = JvmAccountRepository(database)

0 comments on commit 06bfc23

Please sign in to comment.