From 7a68b2f0a0603b2bcb34110019254d4d85d91321 Mon Sep 17 00:00:00 2001 From: MS Date: Fri, 1 Sep 2023 10:42:07 +0200 Subject: Bank DB refactoring. Fixing off-by-one when bringing one account from debit to the credit state. --- sandbox/src/main/kotlin/tech/libeufin/sandbox/Database.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'sandbox/src/main/kotlin/tech/libeufin') diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Database.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Database.kt index e7ca959a..90dd39dc 100644 --- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Database.kt +++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Database.kt @@ -33,7 +33,8 @@ data class BankAccount( val owningCustomerId: Long, val isPublic: Boolean = false, val lastNexusFetchRowId: Long, - val balance: TalerAmount? = null + val balance: TalerAmount? = null, + val hasDebt: Boolean ) enum class TransactionDirection { @@ -254,6 +255,7 @@ class Database(private val dbConfig: String) { ,last_nexus_fetch_row_id ,(balance).val AS balance_value ,(balance).frac AS balance_frac + ,has_debt FROM bank_accounts WHERE bank_account_label=? """) @@ -271,7 +273,8 @@ class Database(private val dbConfig: String) { ), bankAccountLabel = bankAccountLabel, lastNexusFetchRowId = it.getLong("last_nexus_fetch_row_id"), - owningCustomerId = it.getLong("owning_customer_id") + owningCustomerId = it.getLong("owning_customer_id"), + hasDebt = it.getBoolean("has_debt") ) } } -- cgit v1.2.3