This commit is contained in:
dni ⚡ 2024-09-28 13:25:42 +02:00 committed by Vlad Stan
parent 26f69d1cdb
commit 64dc27cc53
5 changed files with 9 additions and 5 deletions

View File

@ -113,8 +113,6 @@ class Account(BaseModel):
username: Optional[str] = None
password_hash: Optional[str] = None
email: Optional[str] = None
balance_msat: Optional[int] = 0
last_payment: Optional[datetime] = None
extra: Optional[UserExtra] = None
created_at: datetime = datetime.now()
updated_at: datetime = datetime.now()
@ -144,6 +142,8 @@ class Account(BaseModel):
class AccountOverview(Account):
transaction_count: Optional[int] = 0
wallet_count: Optional[int] = 0
balance_msat: Optional[int] = 0
last_payment: Optional[datetime] = None
class AccountFilters(FilterModel):

View File

@ -6,7 +6,7 @@
<script src="{{ static_url_for('static', 'js/wallet.js') }}"></script>
{% endblock %}
<!---->
{% block title %} {{ wallet.name }} - {{ SITE_TITLE }} {% endblock %}
{% block title %}{{ wallet_name }} - {{ SITE_TITLE }} {% endblock %}
<!---->
{% block page %}
<div class="row q-col-gutter-md">

View File

@ -202,6 +202,7 @@ async def wallet(
{
"user": user.json(),
"wallet": wallet.json(),
"wallet_name": wallet.name,
"currencies": allowed_currencies(),
"service_fee": settings.lnbits_service_fee,
"service_fee_max": settings.lnbits_service_fee_max,

View File

@ -619,7 +619,7 @@ def dict_to_model(_row: dict, model: type[TModel]) -> TModel:
"""
# TODO: no recursion, maybe make them recursive?
# TODO: check why keys are sometimes not in the dict
_dict = {}
_dict: dict = {}
for key, value in _row.items():
if key not in model.__fields__:
logger.warning(f"Converting {key} to model `{model}`.")
@ -628,6 +628,9 @@ def dict_to_model(_row: dict, model: type[TModel]) -> TModel:
continue
type_ = model.__fields__[key].type_
if issubclass(type_, BaseModel) and value is not None:
if isinstance(value, str) and value == "null":
_dict[key] = None
continue
_dict[key] = type_.construct(**json.loads(value))
continue
_dict[key] = value

View File

@ -585,12 +585,12 @@
:rows="paymentsOmitter"
:row-key="paymentTableRowKey"
:columns="paymentsTable.columns"
:pagination.sync="paymentsTable.pagination"
:no-data-label="$t('no_transactions')"
:filter="paymentsTable.search"
:loading="paymentsTable.loading"
:hide-header="mobileSimple"
:hide-bottom="mobileSimple"
v-model:pagination="paymentsTable.pagination"
@request="fetchPayments"
>
<template v-slot:header="props">