[REFACTOR] WalletType into enum (#1888)

* [REFACTOR] WalletType into enum

- move wallettype models from decorators.py into models.py
- use enum instead of int
- use HTTPStatus for consistency

* Update lnbits/core/models.py

Co-authored-by: jackstar12 <62219658+jackstar12@users.noreply.github.com>

* use dataclass

---------

Co-authored-by: jackstar12 <62219658+jackstar12@users.noreply.github.com>
This commit is contained in:
dni ⚡
2023-08-23 12:41:22 +02:00
committed by GitHub
co-authored by jackstar12
parent 3a653630f1
commit c4da1dfdce
4 changed files with 44 additions and 36 deletions
+2 -1
View File
@@ -7,6 +7,7 @@ from uuid import UUID, uuid4
import shortuuid
from lnbits import bolt11
from lnbits.core.models import WalletType
from lnbits.db import Connection, Database, Filters, Page
from lnbits.extension_manager import InstallableExtension
from lnbits.settings import AdminSettings, EditableSettings, SuperSettings, settings
@@ -294,7 +295,7 @@ async def get_wallet_for_key(
if not row:
return None
if key_type == "admin" and row["adminkey"] != key:
if key_type == WalletType.admin and row["adminkey"] != key:
return None
return Wallet(**row)