PHASE 2: Fixes balance assertion creation and validation

Improves balance assertion creation by handling Decimal types correctly for database insertion.
It also fixes a validation issue in the UI where the expected balance was not correctly validated as a required field and initializes the value to 0.
This commit is contained in:
padreug 2025-10-23 01:55:20 +02:00
parent 0257b7807c
commit c0277dfc98
3 changed files with 36 additions and 42 deletions

View file

@ -70,7 +70,7 @@ window.app = Vue.createApp({
assertionDialog: {
show: false,
account_id: '',
expected_balance_sats: null,
expected_balance_sats: 0,
expected_balance_fiat: null,
fiat_currency: null,
tolerance_sats: 0,
@ -646,7 +646,7 @@ window.app = Vue.createApp({
this.assertionDialog = {
show: false,
account_id: '',
expected_balance_sats: null,
expected_balance_sats: 0,
expected_balance_fiat: null,
fiat_currency: null,
tolerance_sats: 0,
@ -677,12 +677,6 @@ window.app = Vue.createApp({
}
},
async recheckAssertion(assertionId) {
// Set loading state
const assertion = this.balanceAssertions.find(a => a.id === assertionId)
if (assertion) {
this.$set(assertion, 'rechecking', true)
}
try {
await LNbits.api.request(
'POST',
@ -699,19 +693,9 @@ window.app = Vue.createApp({
await this.loadBalanceAssertions()
} catch (error) {
LNbits.utils.notifyApiError(error)
} finally {
if (assertion) {
this.$set(assertion, 'rechecking', false)
}
}
},
async deleteAssertion(assertionId) {
// Set loading state
const assertion = this.balanceAssertions.find(a => a.id === assertionId)
if (assertion) {
this.$set(assertion, 'deleting', true)
}
try {
await LNbits.api.request(
'DELETE',
@ -728,10 +712,6 @@ window.app = Vue.createApp({
await this.loadBalanceAssertions()
} catch (error) {
LNbits.utils.notifyApiError(error)
} finally {
if (assertion) {
this.$set(assertion, 'deleting', false)
}
}
},
getAccountName(accountId) {