Updated to BankingClient version 0.5.2-SNAPSHOT which renamed reference to unparsedReference

This commit is contained in:
dankito 2024-09-02 01:12:23 +02:00
parent e0060d9380
commit 6fe8cdf15d
11 changed files with 18 additions and 17 deletions

View File

@ -120,6 +120,8 @@ sqldelight {
create("BankmeisterDb") { create("BankmeisterDb") {
packageName.set("net.codinux.banking.dataaccess") packageName.set("net.codinux.banking.dataaccess")
generateAsync = true generateAsync = true
schemaOutputDirectory = file("src/commonMain/sqldelight/databases")
} }
} }
} }

View File

@ -100,8 +100,8 @@ open class SqliteBankingRepository(
override fun getAllAccountTransactionsAsViewModel(): List<AccountTransactionViewModel> = override fun getAllAccountTransactionsAsViewModel(): List<AccountTransactionViewModel> =
// TODO: find a better way to express the reference value to display, sepaReference or (unparsed)reference // TODO: find a better way to express the reference value to display, sepaReference or (unparsed)reference
accountTransactionQueries.selectAllTransactionsAsViewModel { id, userAccountId, bankAccountId, amount, currency, reference, valueDate, otherPartyName, bookingText, sepaReference, userSetDisplayName, category -> accountTransactionQueries.selectAllTransactionsAsViewModel { id, userAccountId, bankAccountId, amount, currency, unparsedReference, valueDate, otherPartyName, bookingText, sepaReference, userSetDisplayName, category ->
AccountTransactionViewModel(id, userAccountId, bankAccountId, mapToAmount(amount), currency, sepaReference ?: reference, mapToDate(valueDate), otherPartyName, bookingText, userSetDisplayName, category) AccountTransactionViewModel(id, userAccountId, bankAccountId, mapToAmount(amount), currency, sepaReference ?: unparsedReference, mapToDate(valueDate), otherPartyName, bookingText, userSetDisplayName, category)
}.executeAsList() }.executeAsList()
override fun getAllAccountTransactions(): List<AccountTransactionEntity> { override fun getAllAccountTransactions(): List<AccountTransactionEntity> {
@ -146,7 +146,7 @@ open class SqliteBankingRepository(
accountTransactionQueries.insertTransaction( accountTransactionQueries.insertTransaction(
userAccountId, bankAccountId, userAccountId, bankAccountId,
mapAmount(transaction.amount), transaction.currency, transaction.reference, mapAmount(transaction.amount), transaction.currency, transaction.unparsedReference,
mapDate(transaction.bookingDate), mapDate(transaction.valueDate), mapDate(transaction.bookingDate), mapDate(transaction.valueDate),
transaction.otherPartyName, transaction.otherPartyBankCode, transaction.otherPartyAccountId, transaction.otherPartyName, transaction.otherPartyBankCode, transaction.otherPartyAccountId,
transaction.bookingText, transaction.bookingText,

View File

@ -83,7 +83,7 @@ class AccountTransactionEntity(
) { ) {
constructor(id: Long, userAccountId: Long, bankAccountId: Long, transaction: AccountTransaction) : this( constructor(id: Long, userAccountId: Long, bankAccountId: Long, transaction: AccountTransaction) : this(
id, userAccountId, bankAccountId, id, userAccountId, bankAccountId,
transaction.amount, transaction.currency, transaction.reference, transaction.bookingDate, transaction.valueDate, transaction.amount, transaction.currency, transaction.unparsedReference, transaction.bookingDate, transaction.valueDate,
transaction.otherPartyName, transaction.otherPartyBankCode, transaction.otherPartyAccountId, transaction.bookingText, transaction.otherPartyName, transaction.otherPartyBankCode, transaction.otherPartyAccountId, transaction.bookingText,
transaction.userSetDisplayName, transaction.category, transaction.notes, transaction.information, transaction.userSetDisplayName, transaction.category, transaction.notes, transaction.information,

View File

@ -23,5 +23,5 @@ data class AccountTransactionViewModel(
constructor(entity: AccountTransactionEntity) : this(entity.id, entity.userAccountId, entity.bankAccountId, entity) constructor(entity: AccountTransactionEntity) : this(entity.id, entity.userAccountId, entity.bankAccountId, entity)
constructor(id: Long, userAccountId: Long, bankAccountId: Long, transaction: AccountTransaction) constructor(id: Long, userAccountId: Long, bankAccountId: Long, transaction: AccountTransaction)
: this(id, userAccountId, bankAccountId, transaction.amount, transaction.currency, transaction.sepaReference ?: transaction.reference, transaction.valueDate, transaction.otherPartyName, transaction.bookingText) : this(id, userAccountId, bankAccountId, transaction.amount, transaction.currency, transaction.reference, transaction.valueDate, transaction.otherPartyName, transaction.bookingText)
} }

View File

@ -21,7 +21,7 @@ class BankDataImporterAndExporter {
// TODO: add bank and bank account // TODO: add bank and bank account
formatAmount(transaction.amount, decimalSeparator), transaction.currency, formatAmount(transaction.amount, decimalSeparator), transaction.currency,
transaction.valueDate.toString(), transaction.bookingDate.toString(), transaction.valueDate.toString(), transaction.bookingDate.toString(),
transaction.sepaReference ?: transaction.reference, transaction.reference,
transaction.otherPartyName, transaction.otherPartyBankCode, transaction.otherPartyAccountId transaction.otherPartyName, transaction.otherPartyBankCode, transaction.otherPartyAccountId
// TODO: export all columns / transaction data // TODO: export all columns / transaction data
) )

View File

@ -18,9 +18,7 @@ import net.codinux.banking.fints.config.FinTsClientOptions
import net.codinux.banking.ui.model.AccountTransactionViewModel import net.codinux.banking.ui.model.AccountTransactionViewModel
import net.codinux.banking.ui.model.BankInfo import net.codinux.banking.ui.model.BankInfo
import net.codinux.banking.ui.model.TanChallengeReceived import net.codinux.banking.ui.model.TanChallengeReceived
import net.codinux.banking.ui.model.error.BankingClientAction import net.codinux.banking.ui.model.error.*
import net.codinux.banking.ui.model.error.BankingClientError
import net.codinux.banking.ui.model.error.ErroneousAction
import net.codinux.banking.ui.state.UiState import net.codinux.banking.ui.state.UiState
import net.codinux.csv.reader.CsvReader import net.codinux.csv.reader.CsvReader
import net.codinux.log.logger import net.codinux.log.logger

View File

@ -0,0 +1,2 @@
ALTER TABLE AccountTransaction
RENAME COLUMN reference TO unparsedReference;

View File

@ -6,7 +6,7 @@ CREATE TABLE IF NOT EXISTS AccountTransaction (
amount TEXT NOT NULL, amount TEXT NOT NULL,
currency TEXT NOT NULL, currency TEXT NOT NULL,
reference TEXT NOT NULL, unparsedReference TEXT NOT NULL,
bookingDate TEXT NOT NULL, bookingDate TEXT NOT NULL,
valueDate TEXT NOT NULL, valueDate TEXT NOT NULL,
@ -58,7 +58,7 @@ insertTransaction:
INSERT INTO AccountTransaction( INSERT INTO AccountTransaction(
userAccountId, bankAccountId, userAccountId, bankAccountId,
amount, currency, reference, amount, currency, unparsedReference,
bookingDate, valueDate, bookingDate, valueDate,
otherPartyName, otherPartyBankCode, otherPartyAccountId, otherPartyName, otherPartyBankCode, otherPartyAccountId,
bookingText, bookingText,
@ -118,5 +118,5 @@ SELECT AccountTransaction.*
FROM AccountTransaction; FROM AccountTransaction;
selectAllTransactionsAsViewModel: selectAllTransactionsAsViewModel:
SELECT id, userAccountId, bankAccountId, amount, currency, reference, valueDate, otherPartyName, bookingText, sepaReference, userSetDisplayName, category SELECT id, userAccountId, bankAccountId, amount, currency, unparsedReference, valueDate, otherPartyName, bookingText, sepaReference, userSetDisplayName, category
FROM AccountTransaction; FROM AccountTransaction;

View File

@ -16,7 +16,6 @@ import net.codinux.banking.client.model.Amount
import net.codinux.banking.dataaccess.BankmeisterDb import net.codinux.banking.dataaccess.BankmeisterDb
import net.codinux.banking.dataaccess.InMemoryBankingRepository import net.codinux.banking.dataaccess.InMemoryBankingRepository
import net.codinux.banking.ui.config.DI import net.codinux.banking.ui.config.DI
import net.codinux.log.Log
import org.jetbrains.compose.resources.painterResource import org.jetbrains.compose.resources.painterResource
import java.io.File import java.io.File
@ -29,7 +28,7 @@ fun main() = application {
) { ) {
File("data/db").mkdirs() File("data/db").mkdirs()
DI.setRepository(JdbcSqliteDriver("jdbc:sqlite:data/db/Bankmeister.db").apply { DI.setRepository(JdbcSqliteDriver("jdbc:sqlite:data/db/Bankmeister.db").apply {
val schema = BankmeisterDb.Schema.synchronous().create(this) val schema = BankmeisterDb.Schema.synchronous().migrate(this, 1, 2)
}) })
App() App()

View File

@ -88,7 +88,7 @@ class SqliteBankingRepositoryTest {
assertEquals(transaction.amount, persisted.amount) assertEquals(transaction.amount, persisted.amount)
assertEquals(transaction.currency, persisted.currency) assertEquals(transaction.currency, persisted.currency)
assertEquals(transaction.reference, persisted.reference) assertEquals(transaction.unparsedReference, persisted.unparsedReference)
assertEquals(transaction.bookingDate, persisted.bookingDate) assertEquals(transaction.bookingDate, persisted.bookingDate)
assertEquals(transaction.valueDate, persisted.valueDate) assertEquals(transaction.valueDate, persisted.valueDate)
assertEquals(transaction.otherPartyName, persisted.otherPartyName) assertEquals(transaction.otherPartyName, persisted.otherPartyName)
@ -109,7 +109,7 @@ class SqliteBankingRepositoryTest {
assertEquals(transaction.amount, persisted.amount) assertEquals(transaction.amount, persisted.amount)
assertEquals(transaction.currency, persisted.currency) assertEquals(transaction.currency, persisted.currency)
assertEquals(transaction.reference, persisted.reference) assertEquals(transaction.unparsedReference, persisted.reference)
assertEquals(transaction.valueDate, persisted.valueDate) assertEquals(transaction.valueDate, persisted.valueDate)
assertEquals(transaction.otherPartyName, persisted.otherPartyName) assertEquals(transaction.otherPartyName, persisted.otherPartyName)
} }

View File

@ -2,7 +2,7 @@
kotlin = "2.0.10" kotlin = "2.0.10"
kotlinx-coroutines = "1.8.1" kotlinx-coroutines = "1.8.1"
banking-client = "0.5.1" banking-client = "0.5.2-SNAPSHOT"
kcsv = "2.2.0" kcsv = "2.2.0"
kotlinx-serializable = "1.7.1" kotlinx-serializable = "1.7.1"