diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/dataaccess/SqliteBankingRepository.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/dataaccess/SqliteBankingRepository.kt index 0d69d98..c7d83e6 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/dataaccess/SqliteBankingRepository.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/dataaccess/SqliteBankingRepository.kt @@ -120,7 +120,7 @@ open class SqliteBankingRepository( } - private fun getAllTanMethods(): List = bankQueries.getAllTanMethods { id, bankId, displayName, type, identifier, maxTanInputLength, allowedTanFormat -> + private fun getAllTanMethods(): List = bankQueries.getAllTanMethods { id, bankId, displayName, type, identifier, maxTanInputLength, allowedTanFormat, userSetDisplayName -> TanMethodEntity( id, bankId, @@ -129,7 +129,9 @@ open class SqliteBankingRepository( mapToEnum(type, TanMethodType.entries), identifier, mapToInt(maxTanInputLength), - mapToEnum(allowedTanFormat, AllowedTanFormat.entries) + mapToEnum(allowedTanFormat, AllowedTanFormat.entries), + + userSetDisplayName ) }.executeAsList() @@ -144,7 +146,9 @@ open class SqliteBankingRepository( mapEnum(tanMethod.type), tanMethod.identifier, mapInt(tanMethod.maxTanInputLength), - mapEnum(tanMethod.allowedTanFormat) + mapEnum(tanMethod.allowedTanFormat), + + tanMethod.userSetDisplayName ) val tanMethodId = getLastInsertedId() @@ -153,7 +157,7 @@ open class SqliteBankingRepository( } - private fun getAllTanMedia(): List = bankQueries.getAllTanMedia { id, bankId, type, mediumName, status, phoneNumber, concealedPhoneNumber, cardNumber, cardSequenceNumber, cardType, validFrom, validTo -> + private fun getAllTanMedia(): List = bankQueries.getAllTanMedia { id, bankId, type, mediumName, status, phoneNumber, concealedPhoneNumber, cardNumber, cardSequenceNumber, cardType, validFrom, validTo, userSetDisplayName -> val mobilePhone = if (phoneNumber != null || concealedPhoneNumber != null) { MobilePhoneTanMedium(phoneNumber, concealedPhoneNumber) } else { @@ -175,7 +179,9 @@ open class SqliteBankingRepository( mapToEnum(status, TanMediumStatus.entries), tanGenerator, - mobilePhone + mobilePhone, + + userSetDisplayName ) }.executeAsList() @@ -197,7 +203,9 @@ open class SqliteBankingRepository( medium.tanGenerator?.cardSequenceNumber, mapInt(medium.tanGenerator?.cardType), mapDate(medium.tanGenerator?.validFrom), - mapDate(medium.tanGenerator?.validTo) + mapDate(medium.tanGenerator?.validTo), + + medium.userSetDisplayName ) val tanMediumId = getLastInsertedId() @@ -266,8 +274,8 @@ open class SqliteBankingRepository( override fun getAllAccountTransactionsAsViewModel(): List = - accountTransactionQueries.getAllTransactionsAsViewModel { id, bankId, accountId, amount, currency, reference, valueDate, otherPartyName, postingText, userSetDisplayName, category -> - AccountTransactionViewModel(id, bankId, accountId, mapToAmount(amount), currency, reference, mapToDate(valueDate), otherPartyName, postingText, userSetDisplayName, category) + accountTransactionQueries.getAllTransactionsAsViewModel { id, bankId, accountId, amount, currency, reference, valueDate, otherPartyName, postingText, userSetDisplayName, userSetOtherPartyName -> + AccountTransactionViewModel(id, bankId, accountId, mapToAmount(amount), currency, reference, mapToDate(valueDate), otherPartyName, postingText, userSetDisplayName, userSetOtherPartyName) }.executeAsList() override fun getAllAccountTransactions(): List { @@ -305,7 +313,8 @@ open class SqliteBankingRepository( mapAmount(transaction.openingBalance), mapAmount(transaction.closingBalance), - transaction.userSetDisplayName, transaction.category, transaction.notes, + transaction.userSetReference, transaction.userSetReference, + transaction.category, transaction.notes, transaction.statementNumber?.toLong(), transaction.sheetNumber?.toLong(), @@ -345,7 +354,8 @@ open class SqliteBankingRepository( openingBalance: String?, closingBalance: String?, - userSetDisplayName: String?, category: String?, notes: String?, + userSetDisplayName: String?, userSetReference: String?, + category: String?, notes: String?, statementNumber: Long?, sheetNumber: Long?, @@ -375,7 +385,8 @@ open class SqliteBankingRepository( mapToAmount(openingBalance), mapToAmount(closingBalance), - userSetDisplayName, category, notes, + userSetDisplayName, userSetReference, + category, notes, statementNumber?.toInt(), sheetNumber?.toInt(), diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/dataaccess/entities/AccountTransactionEntity.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/dataaccess/entities/AccountTransactionEntity.kt index 8d8af10..1b14ad5 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/dataaccess/entities/AccountTransactionEntity.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/dataaccess/entities/AccountTransactionEntity.kt @@ -25,7 +25,8 @@ class AccountTransactionEntity( openingBalance: Amount? = null, closingBalance: Amount? = null, - userSetDisplayName: String? = null, + userSetReference: String? = null, + userSetOtherPartyName: String? = null, category: String? = null, notes: String? = null, @@ -80,7 +81,7 @@ class AccountTransactionEntity( isReversal, - userSetDisplayName, category, notes + userSetReference, userSetOtherPartyName, category, notes ) { constructor(id: Long, bankId: Long, accountId: Long, transaction: AccountTransaction) : this( id, bankId, accountId, @@ -93,7 +94,8 @@ class AccountTransactionEntity( transaction.openingBalance, transaction.closingBalance, - transaction.userSetDisplayName, transaction.category, transaction.notes, + transaction.userSetReference, transaction.userSetOtherPartyName, + transaction.category, transaction.notes, transaction.statementNumber, transaction.sheetNumber, diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/dataaccess/entities/BankAccountEntity.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/dataaccess/entities/BankAccountEntity.kt index 50f868c..3d5158c 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/dataaccess/entities/BankAccountEntity.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/dataaccess/entities/BankAccountEntity.kt @@ -3,6 +3,7 @@ package net.codinux.banking.dataaccess.entities import kotlinx.datetime.Instant import kotlinx.datetime.LocalDate import net.codinux.banking.client.model.* +import kotlin.jvm.JvmName class BankAccountEntity( val id: Long, @@ -74,6 +75,7 @@ class BankAccountEntity( ) + @JvmName("addHoldingsEntities") fun addHoldings(holdings: List) { this.holdings.addAll(holdings) } diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/dataaccess/entities/TanMediumEntity.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/dataaccess/entities/TanMediumEntity.kt index 7412b19..67b8e45 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/dataaccess/entities/TanMediumEntity.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/dataaccess/entities/TanMediumEntity.kt @@ -11,10 +11,12 @@ class TanMediumEntity( status: TanMediumStatus, tanGenerator: TanGeneratorTanMedium? = null, - mobilePhone: MobilePhoneTanMedium? = null -) : TanMedium(type, mediumName, status, tanGenerator, mobilePhone) { + mobilePhone: MobilePhoneTanMedium? = null, + + userSetDisplayName: String? = null +) : TanMedium(type, mediumName, status, tanGenerator, mobilePhone, userSetDisplayName) { constructor(id: Long, bankId: Long, medium: TanMedium) - : this(id, bankId, medium.type, medium.mediumName, medium.status, medium.tanGenerator, medium.mobilePhone) + : this(id, bankId, medium.type, medium.mediumName, medium.status, medium.tanGenerator, medium.mobilePhone, medium.userSetDisplayName) } \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/dataaccess/entities/TanMethodEntity.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/dataaccess/entities/TanMethodEntity.kt index ff8e5b9..72a37c3 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/dataaccess/entities/TanMethodEntity.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/dataaccess/entities/TanMethodEntity.kt @@ -12,10 +12,12 @@ class TanMethodEntity( type: TanMethodType, identifier: String, maxTanInputLength: Int? = null, - allowedTanFormat: AllowedTanFormat = AllowedTanFormat.Alphanumeric -) : TanMethod(displayName, type, identifier, maxTanInputLength, allowedTanFormat) { + allowedTanFormat: AllowedTanFormat = AllowedTanFormat.Alphanumeric, + + userSetDisplayName: String? = null, +) : TanMethod(displayName, type, identifier, maxTanInputLength, allowedTanFormat, userSetDisplayName) { constructor(id: Long, bankId: Long, tanMethod: TanMethod) - : this(id, bankId, tanMethod.displayName, tanMethod.type, tanMethod.identifier, tanMethod.maxTanInputLength, tanMethod.allowedTanFormat) + : this(id, bankId, tanMethod.displayName, tanMethod.type, tanMethod.identifier, tanMethod.maxTanInputLength, tanMethod.allowedTanFormat, tanMethod.userSetDisplayName) } \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/model/AccountTransactionViewModel.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/model/AccountTransactionViewModel.kt index e73ad0f..50ec664 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/model/AccountTransactionViewModel.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/model/AccountTransactionViewModel.kt @@ -17,11 +17,11 @@ data class AccountTransactionViewModel( val otherPartyName: String? = null, val postingText: String? = null, - val userSetDisplayName: String? = null, - val category: String? = null + val userSetReference: String? = null, + val userSetOtherPartyName: String? = null ) { constructor(entity: AccountTransactionEntity) : this(entity.id, entity.bankId, entity.accountId, entity) constructor(id: Long, bankId: Long, accountId: Long, transaction: AccountTransaction) - : this(id, bankId, accountId, transaction.amount, transaction.currency, transaction.reference, transaction.valueDate, transaction.otherPartyName, transaction.postingText) + : this(id, bankId, accountId, transaction.amount, transaction.currency, transaction.reference, transaction.valueDate, transaction.otherPartyName, transaction.postingText, transaction.userSetReference, transaction.userSetOtherPartyName) } diff --git a/composeApp/src/commonMain/sqldelight/net/codinux/banking/ui/AccountTransaction.sq b/composeApp/src/commonMain/sqldelight/net/codinux/banking/ui/AccountTransaction.sq index e495e45..0f81d96 100644 --- a/composeApp/src/commonMain/sqldelight/net/codinux/banking/ui/AccountTransaction.sq +++ b/composeApp/src/commonMain/sqldelight/net/codinux/banking/ui/AccountTransaction.sq @@ -22,7 +22,8 @@ CREATE TABLE IF NOT EXISTS AccountTransaction ( openingBalance TEXT, closingBalance TEXT, - userSetDisplayName TEXT, + userSetReference TEXT, + userSetOtherPartyName TEXT, category TEXT, notes TEXT, @@ -72,7 +73,8 @@ INSERT INTO AccountTransaction( openingBalance, closingBalance, - userSetDisplayName, category, notes, + userSetReference, userSetOtherPartyName, + category, notes, statementNumber, sheetNumber, @@ -102,7 +104,8 @@ VALUES( ?, ?, - ?, ?, ?, + ?, ?, + ?, ?, ?, ?, @@ -129,7 +132,7 @@ SELECT AccountTransaction.* FROM AccountTransaction; getAllTransactionsAsViewModel: -SELECT id, bankId, accountId, amount, currency, reference, valueDate, otherPartyName, postingText, userSetDisplayName, category +SELECT id, bankId, accountId, amount, currency, reference, valueDate, otherPartyName, postingText, userSetReference, userSetOtherPartyName FROM AccountTransaction; diff --git a/composeApp/src/commonMain/sqldelight/net/codinux/banking/ui/Bank.sq b/composeApp/src/commonMain/sqldelight/net/codinux/banking/ui/Bank.sq index 9d186e7..ef273dd 100644 --- a/composeApp/src/commonMain/sqldelight/net/codinux/banking/ui/Bank.sq +++ b/composeApp/src/commonMain/sqldelight/net/codinux/banking/ui/Bank.sq @@ -165,7 +165,9 @@ CREATE TABLE IF NOT EXISTS TanMethod ( type TEXT NOT NULL, identifier TEXT NOT NULL, maxTanInputLength INTEGER , - allowedTanFormat TEXT NOT NULL + allowedTanFormat TEXT NOT NULL, + + userSetDisplayName TEXT ); CREATE INDEX idx_TanMethod_bankId @@ -180,7 +182,9 @@ INSERT INTO TanMethod( type, identifier, maxTanInputLength, - allowedTanFormat + allowedTanFormat, + + userSetDisplayName ) VALUES ( ?, @@ -189,6 +193,8 @@ VALUES ( ?, ?, ?, + ?, + ? ); @@ -217,7 +223,9 @@ CREATE TABLE IF NOT EXISTS TanMedium ( cardSequenceNumber TEXT, cardType INTEGER, validFrom TEXT, - validTo TEXT + validTo TEXT, + + userSetDisplayName TEXT ); CREATE INDEX idx_TanMedium_bankId @@ -239,7 +247,9 @@ INSERT INTO TanMedium( cardSequenceNumber, cardType, validFrom, - validTo + validTo, + + userSetDisplayName ) VALUES ( ?, @@ -255,6 +265,8 @@ VALUES ( ?, ?, ?, + ?, + ? );