Persisting haveAllTransactionsBeenRetrieved

This commit is contained in:
dankito 2024-09-02 01:58:15 +02:00
parent 6fe8cdf15d
commit a9cceda7b4
5 changed files with 13 additions and 8 deletions

View File

@ -48,7 +48,7 @@ open class SqliteBankingRepository(
fun getAllBankAccounts(): List<BankAccountEntity> = userAccountQueries.selectAllBankAccounts { id, userAccountId, identifier, accountHolderName, type, iban, subAccountNumber, productName, currency, accountLimit, isAccountTypeSupportedByApplication, features, balance, retrievedTransactionsFrom, retrievedTransactionsTo, countDaysForWhichTransactionsAreKept, userSetDisplayName, displayIndex, hideAccount, includeInAutomaticAccountsUpdate -> fun getAllBankAccounts(): List<BankAccountEntity> = userAccountQueries.selectAllBankAccounts { id, userAccountId, identifier, accountHolderName, type, iban, subAccountNumber, productName, currency, accountLimit, isAccountTypeSupportedByApplication, features, balance, retrievedTransactionsFrom, retrievedTransactionsTo, haveAllTransactionsBeenRetrieved, countDaysForWhichTransactionsAreKept, userSetDisplayName, displayIndex, hideAccount, includeInAutomaticAccountsUpdate ->
BankAccountEntity( BankAccountEntity(
id, userAccountId, id, userAccountId,
identifier, accountHolderName, BankAccountType.valueOf(type), identifier, accountHolderName, BankAccountType.valueOf(type),
@ -56,7 +56,7 @@ open class SqliteBankingRepository(
isAccountTypeSupportedByApplication, mapEnumSet(features, BankAccountFeatures.entries), isAccountTypeSupportedByApplication, mapEnumSet(features, BankAccountFeatures.entries),
mapToAmount(balance), mapToDate(retrievedTransactionsFrom), mapToDate(retrievedTransactionsTo), mapToAmount(balance), mapToDate(retrievedTransactionsFrom), mapToDate(retrievedTransactionsTo),
mapToInt(countDaysForWhichTransactionsAreKept), haveAllTransactionsBeenRetrieved, mapToInt(countDaysForWhichTransactionsAreKept),
mutableListOf(), mutableListOf(), mutableListOf(), mutableListOf(),
@ -82,7 +82,7 @@ open class SqliteBankingRepository(
mapAmount(account.balance), mapAmount(account.balance),
mapDate(account.retrievedTransactionsFrom), mapDate(account.retrievedTransactionsTo), mapDate(account.retrievedTransactionsFrom), mapDate(account.retrievedTransactionsTo),
mapInt(account.countDaysForWhichTransactionsAreKept), account.haveAllTransactionsBeenRetrieved, mapInt(account.countDaysForWhichTransactionsAreKept),
account.userSetDisplayName, mapInt(account.displayIndex), account.userSetDisplayName, mapInt(account.displayIndex),
account.hideAccount, account.includeInAutomaticAccountsUpdate account.hideAccount, account.includeInAutomaticAccountsUpdate

View File

@ -23,6 +23,7 @@ class BankAccountEntity(
retrievedTransactionsFrom: LocalDate? = null, retrievedTransactionsFrom: LocalDate? = null,
retrievedTransactionsTo: LocalDate? = null, retrievedTransactionsTo: LocalDate? = null,
haveAllTransactionsBeenRetrieved: Boolean = false,
countDaysForWhichTransactionsAreKept: Int? = null, countDaysForWhichTransactionsAreKept: Int? = null,
bookedTransactions: MutableList<AccountTransactionEntity> = mutableListOf(), bookedTransactions: MutableList<AccountTransactionEntity> = mutableListOf(),
@ -36,7 +37,7 @@ class BankAccountEntity(
) : BankAccount( ) : BankAccount(
identifier, accountHolderName, type, iban, subAccountNumber, productName, currency, accountLimit, identifier, accountHolderName, type, iban, subAccountNumber, productName, currency, accountLimit,
isAccountTypeSupportedByApplication, features, balance, isAccountTypeSupportedByApplication, features, balance,
retrievedTransactionsFrom, retrievedTransactionsTo, false, countDaysForWhichTransactionsAreKept, retrievedTransactionsFrom, retrievedTransactionsTo, haveAllTransactionsBeenRetrieved, countDaysForWhichTransactionsAreKept,
bookedTransactions as MutableList<AccountTransaction>, unbookedTransactions, bookedTransactions as MutableList<AccountTransaction>, unbookedTransactions,
userSetDisplayName, displayIndex, hideAccount, includeInAutomaticAccountsUpdate userSetDisplayName, displayIndex, hideAccount, includeInAutomaticAccountsUpdate
) { ) {
@ -45,7 +46,8 @@ class BankAccountEntity(
account.identifier, account.accountHolderName, account.type, account.iban, account.subAccountNumber, account.identifier, account.accountHolderName, account.type, account.iban, account.subAccountNumber,
account.productName, account.currency, account.accountLimit, account.productName, account.currency, account.accountLimit,
account.isAccountTypeSupportedByApplication, account.features, account.balance, account.isAccountTypeSupportedByApplication, account.features, account.balance,
account.retrievedTransactionsFrom, account.retrievedTransactionsTo, account.countDaysForWhichTransactionsAreKept, account.retrievedTransactionsFrom, account.retrievedTransactionsTo,
account.haveAllTransactionsBeenRetrieved, account.countDaysForWhichTransactionsAreKept,
transactions.toMutableList(), mutableListOf(), transactions.toMutableList(), mutableListOf(),
account.userSetDisplayName, account.displayIndex, account.hideAccount, account.includeInAutomaticAccountsUpdate account.userSetDisplayName, account.displayIndex, account.hideAccount, account.includeInAutomaticAccountsUpdate
) )

View File

@ -0,0 +1,2 @@
ALTER TABLE BankAccount
ADD COLUMN haveAllTransactionsBeenRetrieved INTEGER AS Boolean NOT NULL DEFAULT 0;

View File

@ -85,6 +85,7 @@ CREATE TABLE IF NOT EXISTS BankAccount (
retrievedTransactionsFrom TEXT, retrievedTransactionsFrom TEXT,
retrievedTransactionsTo TEXT, retrievedTransactionsTo TEXT,
haveAllTransactionsBeenRetrieved INTEGER AS Boolean NOT NULL,
countDaysForWhichTransactionsAreKept INTEGER, countDaysForWhichTransactionsAreKept INTEGER,
userSetDisplayName TEXT, userSetDisplayName TEXT,
@ -106,7 +107,7 @@ INSERT INTO BankAccount(
balance, retrievedTransactionsFrom, retrievedTransactionsTo, balance, retrievedTransactionsFrom, retrievedTransactionsTo,
countDaysForWhichTransactionsAreKept, haveAllTransactionsBeenRetrieved, countDaysForWhichTransactionsAreKept,
userSetDisplayName, displayIndex, userSetDisplayName, displayIndex,
@ -122,7 +123,7 @@ VALUES(
?, ?, ?, ?, ?, ?,
?, ?, ?,
?, ?, ?, ?,

View File

@ -28,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().migrate(this, 1, 2) val schema = BankmeisterDb.Schema.synchronous().migrate(this, BankmeisterDb.Schema.version, 3)
}) })
App() App()