Adjusted to new data model that AccountTransaction now has userSetReference and userSetOtherPartyName, and that userSetDisplayName got added to TanMedium, TanMethod and Holding
This commit is contained in:
parent
34f2fca126
commit
75ccc648c5
|
@ -120,7 +120,7 @@ open class SqliteBankingRepository(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun getAllTanMethods(): List<TanMethodEntity> = bankQueries.getAllTanMethods { id, bankId, displayName, type, identifier, maxTanInputLength, allowedTanFormat ->
|
private fun getAllTanMethods(): List<TanMethodEntity> = bankQueries.getAllTanMethods { id, bankId, displayName, type, identifier, maxTanInputLength, allowedTanFormat, userSetDisplayName ->
|
||||||
TanMethodEntity(
|
TanMethodEntity(
|
||||||
id,
|
id,
|
||||||
bankId,
|
bankId,
|
||||||
|
@ -129,7 +129,9 @@ open class SqliteBankingRepository(
|
||||||
mapToEnum(type, TanMethodType.entries),
|
mapToEnum(type, TanMethodType.entries),
|
||||||
identifier,
|
identifier,
|
||||||
mapToInt(maxTanInputLength),
|
mapToInt(maxTanInputLength),
|
||||||
mapToEnum(allowedTanFormat, AllowedTanFormat.entries)
|
mapToEnum(allowedTanFormat, AllowedTanFormat.entries),
|
||||||
|
|
||||||
|
userSetDisplayName
|
||||||
)
|
)
|
||||||
}.executeAsList()
|
}.executeAsList()
|
||||||
|
|
||||||
|
@ -144,7 +146,9 @@ open class SqliteBankingRepository(
|
||||||
mapEnum(tanMethod.type),
|
mapEnum(tanMethod.type),
|
||||||
tanMethod.identifier,
|
tanMethod.identifier,
|
||||||
mapInt(tanMethod.maxTanInputLength),
|
mapInt(tanMethod.maxTanInputLength),
|
||||||
mapEnum(tanMethod.allowedTanFormat)
|
mapEnum(tanMethod.allowedTanFormat),
|
||||||
|
|
||||||
|
tanMethod.userSetDisplayName
|
||||||
)
|
)
|
||||||
|
|
||||||
val tanMethodId = getLastInsertedId()
|
val tanMethodId = getLastInsertedId()
|
||||||
|
@ -153,7 +157,7 @@ open class SqliteBankingRepository(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun getAllTanMedia(): List<TanMediumEntity> = bankQueries.getAllTanMedia { id, bankId, type, mediumName, status, phoneNumber, concealedPhoneNumber, cardNumber, cardSequenceNumber, cardType, validFrom, validTo ->
|
private fun getAllTanMedia(): List<TanMediumEntity> = bankQueries.getAllTanMedia { id, bankId, type, mediumName, status, phoneNumber, concealedPhoneNumber, cardNumber, cardSequenceNumber, cardType, validFrom, validTo, userSetDisplayName ->
|
||||||
val mobilePhone = if (phoneNumber != null || concealedPhoneNumber != null) {
|
val mobilePhone = if (phoneNumber != null || concealedPhoneNumber != null) {
|
||||||
MobilePhoneTanMedium(phoneNumber, concealedPhoneNumber)
|
MobilePhoneTanMedium(phoneNumber, concealedPhoneNumber)
|
||||||
} else {
|
} else {
|
||||||
|
@ -175,7 +179,9 @@ open class SqliteBankingRepository(
|
||||||
mapToEnum(status, TanMediumStatus.entries),
|
mapToEnum(status, TanMediumStatus.entries),
|
||||||
|
|
||||||
tanGenerator,
|
tanGenerator,
|
||||||
mobilePhone
|
mobilePhone,
|
||||||
|
|
||||||
|
userSetDisplayName
|
||||||
)
|
)
|
||||||
}.executeAsList()
|
}.executeAsList()
|
||||||
|
|
||||||
|
@ -197,7 +203,9 @@ open class SqliteBankingRepository(
|
||||||
medium.tanGenerator?.cardSequenceNumber,
|
medium.tanGenerator?.cardSequenceNumber,
|
||||||
mapInt(medium.tanGenerator?.cardType),
|
mapInt(medium.tanGenerator?.cardType),
|
||||||
mapDate(medium.tanGenerator?.validFrom),
|
mapDate(medium.tanGenerator?.validFrom),
|
||||||
mapDate(medium.tanGenerator?.validTo)
|
mapDate(medium.tanGenerator?.validTo),
|
||||||
|
|
||||||
|
medium.userSetDisplayName
|
||||||
)
|
)
|
||||||
|
|
||||||
val tanMediumId = getLastInsertedId()
|
val tanMediumId = getLastInsertedId()
|
||||||
|
@ -266,8 +274,8 @@ open class SqliteBankingRepository(
|
||||||
|
|
||||||
|
|
||||||
override fun getAllAccountTransactionsAsViewModel(): List<AccountTransactionViewModel> =
|
override fun getAllAccountTransactionsAsViewModel(): List<AccountTransactionViewModel> =
|
||||||
accountTransactionQueries.getAllTransactionsAsViewModel { id, bankId, accountId, amount, currency, reference, 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, category)
|
AccountTransactionViewModel(id, bankId, accountId, mapToAmount(amount), currency, reference, mapToDate(valueDate), otherPartyName, postingText, userSetDisplayName, userSetOtherPartyName)
|
||||||
}.executeAsList()
|
}.executeAsList()
|
||||||
|
|
||||||
override fun getAllAccountTransactions(): List<AccountTransactionEntity> {
|
override fun getAllAccountTransactions(): List<AccountTransactionEntity> {
|
||||||
|
@ -305,7 +313,8 @@ open class SqliteBankingRepository(
|
||||||
|
|
||||||
mapAmount(transaction.openingBalance), mapAmount(transaction.closingBalance),
|
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(),
|
transaction.statementNumber?.toLong(), transaction.sheetNumber?.toLong(),
|
||||||
|
|
||||||
|
@ -345,7 +354,8 @@ open class SqliteBankingRepository(
|
||||||
|
|
||||||
openingBalance: String?, closingBalance: String?,
|
openingBalance: String?, closingBalance: String?,
|
||||||
|
|
||||||
userSetDisplayName: String?, category: String?, notes: String?,
|
userSetDisplayName: String?, userSetReference: String?,
|
||||||
|
category: String?, notes: String?,
|
||||||
|
|
||||||
statementNumber: Long?, sheetNumber: Long?,
|
statementNumber: Long?, sheetNumber: Long?,
|
||||||
|
|
||||||
|
@ -375,7 +385,8 @@ open class SqliteBankingRepository(
|
||||||
|
|
||||||
mapToAmount(openingBalance), mapToAmount(closingBalance),
|
mapToAmount(openingBalance), mapToAmount(closingBalance),
|
||||||
|
|
||||||
userSetDisplayName, category, notes,
|
userSetDisplayName, userSetReference,
|
||||||
|
category, notes,
|
||||||
|
|
||||||
statementNumber?.toInt(), sheetNumber?.toInt(),
|
statementNumber?.toInt(), sheetNumber?.toInt(),
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,8 @@ class AccountTransactionEntity(
|
||||||
openingBalance: Amount? = null,
|
openingBalance: Amount? = null,
|
||||||
closingBalance: Amount? = null,
|
closingBalance: Amount? = null,
|
||||||
|
|
||||||
userSetDisplayName: String? = null,
|
userSetReference: String? = null,
|
||||||
|
userSetOtherPartyName: String? = null,
|
||||||
category: String? = null,
|
category: String? = null,
|
||||||
notes: String? = null,
|
notes: String? = null,
|
||||||
|
|
||||||
|
@ -80,7 +81,7 @@ class AccountTransactionEntity(
|
||||||
|
|
||||||
isReversal,
|
isReversal,
|
||||||
|
|
||||||
userSetDisplayName, category, notes
|
userSetReference, userSetOtherPartyName, category, notes
|
||||||
) {
|
) {
|
||||||
constructor(id: Long, bankId: Long, accountId: Long, transaction: AccountTransaction) : this(
|
constructor(id: Long, bankId: Long, accountId: Long, transaction: AccountTransaction) : this(
|
||||||
id, bankId, accountId,
|
id, bankId, accountId,
|
||||||
|
@ -93,7 +94,8 @@ class AccountTransactionEntity(
|
||||||
|
|
||||||
transaction.openingBalance, transaction.closingBalance,
|
transaction.openingBalance, transaction.closingBalance,
|
||||||
|
|
||||||
transaction.userSetDisplayName, transaction.category, transaction.notes,
|
transaction.userSetReference, transaction.userSetOtherPartyName,
|
||||||
|
transaction.category, transaction.notes,
|
||||||
|
|
||||||
transaction.statementNumber, transaction.sheetNumber,
|
transaction.statementNumber, transaction.sheetNumber,
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package net.codinux.banking.dataaccess.entities
|
||||||
import kotlinx.datetime.Instant
|
import kotlinx.datetime.Instant
|
||||||
import kotlinx.datetime.LocalDate
|
import kotlinx.datetime.LocalDate
|
||||||
import net.codinux.banking.client.model.*
|
import net.codinux.banking.client.model.*
|
||||||
|
import kotlin.jvm.JvmName
|
||||||
|
|
||||||
class BankAccountEntity(
|
class BankAccountEntity(
|
||||||
val id: Long,
|
val id: Long,
|
||||||
|
@ -74,6 +75,7 @@ class BankAccountEntity(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@JvmName("addHoldingsEntities")
|
||||||
fun addHoldings(holdings: List<HoldingEntity>) {
|
fun addHoldings(holdings: List<HoldingEntity>) {
|
||||||
this.holdings.addAll(holdings)
|
this.holdings.addAll(holdings)
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,10 +11,12 @@ class TanMediumEntity(
|
||||||
status: TanMediumStatus,
|
status: TanMediumStatus,
|
||||||
|
|
||||||
tanGenerator: TanGeneratorTanMedium? = null,
|
tanGenerator: TanGeneratorTanMedium? = null,
|
||||||
mobilePhone: MobilePhoneTanMedium? = null
|
mobilePhone: MobilePhoneTanMedium? = null,
|
||||||
) : TanMedium(type, mediumName, status, tanGenerator, mobilePhone) {
|
|
||||||
|
userSetDisplayName: String? = null
|
||||||
|
) : TanMedium(type, mediumName, status, tanGenerator, mobilePhone, userSetDisplayName) {
|
||||||
|
|
||||||
constructor(id: Long, bankId: Long, medium: TanMedium)
|
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)
|
||||||
|
|
||||||
}
|
}
|
|
@ -12,10 +12,12 @@ class TanMethodEntity(
|
||||||
type: TanMethodType,
|
type: TanMethodType,
|
||||||
identifier: String,
|
identifier: String,
|
||||||
maxTanInputLength: Int? = null,
|
maxTanInputLength: Int? = null,
|
||||||
allowedTanFormat: AllowedTanFormat = AllowedTanFormat.Alphanumeric
|
allowedTanFormat: AllowedTanFormat = AllowedTanFormat.Alphanumeric,
|
||||||
) : TanMethod(displayName, type, identifier, maxTanInputLength, allowedTanFormat) {
|
|
||||||
|
userSetDisplayName: String? = null,
|
||||||
|
) : TanMethod(displayName, type, identifier, maxTanInputLength, allowedTanFormat, userSetDisplayName) {
|
||||||
|
|
||||||
constructor(id: Long, bankId: Long, tanMethod: TanMethod)
|
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)
|
||||||
|
|
||||||
}
|
}
|
|
@ -17,11 +17,11 @@ data class AccountTransactionViewModel(
|
||||||
val otherPartyName: String? = null,
|
val otherPartyName: String? = null,
|
||||||
|
|
||||||
val postingText: String? = null,
|
val postingText: String? = null,
|
||||||
val userSetDisplayName: String? = null,
|
val userSetReference: String? = null,
|
||||||
val category: String? = null
|
val userSetOtherPartyName: String? = null
|
||||||
) {
|
) {
|
||||||
constructor(entity: AccountTransactionEntity) : this(entity.id, entity.bankId, entity.accountId, entity)
|
constructor(entity: AccountTransactionEntity) : this(entity.id, entity.bankId, entity.accountId, entity)
|
||||||
|
|
||||||
constructor(id: Long, bankId: Long, accountId: Long, transaction: AccountTransaction)
|
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)
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,8 @@ CREATE TABLE IF NOT EXISTS AccountTransaction (
|
||||||
openingBalance TEXT,
|
openingBalance TEXT,
|
||||||
closingBalance TEXT,
|
closingBalance TEXT,
|
||||||
|
|
||||||
userSetDisplayName TEXT,
|
userSetReference TEXT,
|
||||||
|
userSetOtherPartyName TEXT,
|
||||||
category TEXT,
|
category TEXT,
|
||||||
notes TEXT,
|
notes TEXT,
|
||||||
|
|
||||||
|
@ -72,7 +73,8 @@ INSERT INTO AccountTransaction(
|
||||||
|
|
||||||
openingBalance, closingBalance,
|
openingBalance, closingBalance,
|
||||||
|
|
||||||
userSetDisplayName, category, notes,
|
userSetReference, userSetOtherPartyName,
|
||||||
|
category, notes,
|
||||||
|
|
||||||
statementNumber, sheetNumber,
|
statementNumber, sheetNumber,
|
||||||
|
|
||||||
|
@ -102,7 +104,8 @@ VALUES(
|
||||||
|
|
||||||
?, ?,
|
?, ?,
|
||||||
|
|
||||||
?, ?, ?,
|
?, ?,
|
||||||
|
?, ?,
|
||||||
|
|
||||||
?, ?,
|
?, ?,
|
||||||
|
|
||||||
|
@ -129,7 +132,7 @@ SELECT AccountTransaction.*
|
||||||
FROM AccountTransaction;
|
FROM AccountTransaction;
|
||||||
|
|
||||||
getAllTransactionsAsViewModel:
|
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;
|
FROM AccountTransaction;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -165,7 +165,9 @@ CREATE TABLE IF NOT EXISTS TanMethod (
|
||||||
type TEXT NOT NULL,
|
type TEXT NOT NULL,
|
||||||
identifier TEXT NOT NULL,
|
identifier TEXT NOT NULL,
|
||||||
maxTanInputLength INTEGER ,
|
maxTanInputLength INTEGER ,
|
||||||
allowedTanFormat TEXT NOT NULL
|
allowedTanFormat TEXT NOT NULL,
|
||||||
|
|
||||||
|
userSetDisplayName TEXT
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE INDEX idx_TanMethod_bankId
|
CREATE INDEX idx_TanMethod_bankId
|
||||||
|
@ -180,7 +182,9 @@ INSERT INTO TanMethod(
|
||||||
type,
|
type,
|
||||||
identifier,
|
identifier,
|
||||||
maxTanInputLength,
|
maxTanInputLength,
|
||||||
allowedTanFormat
|
allowedTanFormat,
|
||||||
|
|
||||||
|
userSetDisplayName
|
||||||
)
|
)
|
||||||
VALUES (
|
VALUES (
|
||||||
?,
|
?,
|
||||||
|
@ -189,6 +193,8 @@ VALUES (
|
||||||
?,
|
?,
|
||||||
?,
|
?,
|
||||||
?,
|
?,
|
||||||
|
?,
|
||||||
|
|
||||||
?
|
?
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -217,7 +223,9 @@ CREATE TABLE IF NOT EXISTS TanMedium (
|
||||||
cardSequenceNumber TEXT,
|
cardSequenceNumber TEXT,
|
||||||
cardType INTEGER,
|
cardType INTEGER,
|
||||||
validFrom TEXT,
|
validFrom TEXT,
|
||||||
validTo TEXT
|
validTo TEXT,
|
||||||
|
|
||||||
|
userSetDisplayName TEXT
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE INDEX idx_TanMedium_bankId
|
CREATE INDEX idx_TanMedium_bankId
|
||||||
|
@ -239,7 +247,9 @@ INSERT INTO TanMedium(
|
||||||
cardSequenceNumber,
|
cardSequenceNumber,
|
||||||
cardType,
|
cardType,
|
||||||
validFrom,
|
validFrom,
|
||||||
validTo
|
validTo,
|
||||||
|
|
||||||
|
userSetDisplayName
|
||||||
)
|
)
|
||||||
VALUES (
|
VALUES (
|
||||||
?,
|
?,
|
||||||
|
@ -255,6 +265,8 @@ VALUES (
|
||||||
?,
|
?,
|
||||||
?,
|
?,
|
||||||
?,
|
?,
|
||||||
|
?,
|
||||||
|
|
||||||
?
|
?
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue