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

@ -302,7 +302,6 @@
round
icon="refresh"
@click="recheckAssertion(assertion.id)"
:loading="assertion.rechecking"
>
<q-tooltip>Re-check assertion</q-tooltip>
</q-btn>
@ -312,7 +311,6 @@
round
icon="delete"
@click="deleteAssertion(assertion.id)"
:loading="assertion.deleting"
>
<q-tooltip>Delete assertion</q-tooltip>
</q-btn>
@ -353,7 +351,6 @@
round
icon="refresh"
@click="recheckAssertion(assertion.id)"
:loading="assertion.rechecking"
>
<q-tooltip>Re-check assertion</q-tooltip>
</q-btn>
@ -363,7 +360,6 @@
round
icon="delete"
@click="deleteAssertion(assertion.id)"
:loading="assertion.deleting"
>
<q-tooltip>Delete assertion</q-tooltip>
</q-btn>
@ -929,12 +925,9 @@
v-model.number="assertionDialog.expected_balance_sats"
type="number"
label="Expected Balance (sats) *"
:rules="[val => val !== null && val !== undefined || 'Expected balance is required']"
>
<template v-slot:hint>
The balance you expect this account to have in satoshis
</template>
</q-input>
hint="The balance you expect this account to have in satoshis"
:rules="[val => val !== null && val !== undefined && val !== '' || 'Expected balance is required']"
></q-input>
<q-input
filled
@ -943,15 +936,12 @@
type="number"
label="Tolerance (sats)"
min="0"
>
<template v-slot:hint>
Allow the actual balance to differ by ± this amount (default: 0)
</template>
</q-input>
hint="Allow the actual balance to differ by ± this amount (default: 0)"
></q-input>
<q-separator />
<q-separator class="q-my-md"></q-separator>
<div class="text-subtitle2">Optional: Fiat Balance Check</div>
<div class="text-subtitle2 q-mb-sm">Optional: Fiat Balance Check</div>
<q-select
filled
@ -987,11 +977,11 @@
min="0"
></q-input>
<div class="row q-mt-lg">
<div class="row q-mt-md q-gutter-sm">
<q-btn unelevated color="primary" type="submit" :loading="assertionDialog.loading">
Create & Check
</q-btn>
<q-btn v-close-popup flat color="grey" class="q-ml-auto">Cancel</q-btn>
<q-btn v-close-popup flat color="grey">Cancel</q-btn>
</div>
</q-form>
</q-card>