fix: main page and creating a user and a wallet

The wallet page will still not renders correctly, but the backend does
create the user his first wallet.
This commit is contained in:
Stefan Stammberger
2021-08-24 21:23:18 +02:00
parent de4d3b012c
commit f119053953
3 changed files with 47 additions and 49 deletions
+16 -16
View File
@@ -10,22 +10,6 @@ from pydantic import BaseModel
from lnbits.settings import WALLET
class User(BaseModel):
id: str
email: str
extensions: List[str] = []
wallets: List["Wallet"] = []
password: Optional[str] = None
@property
def wallet_ids(self) -> List[str]:
return [wallet.id for wallet in self.wallets]
def get_wallet(self, wallet_id: str) -> Optional["Wallet"]:
w = [wallet for wallet in self.wallets if wallet.id == wallet_id]
return w[0] if w else None
class Wallet(BaseModel):
id: str
name: str
@@ -73,6 +57,22 @@ class Wallet(BaseModel):
return await get_wallet_payment(self.id, payment_hash)
class User(BaseModel):
id: str
email: Optional[str] = None
extensions: List[str] = []
wallets: List[Wallet] = []
password: Optional[str] = None
@property
def wallet_ids(self) -> List[str]:
return [wallet.id for wallet in self.wallets]
def get_wallet(self, wallet_id: str) -> Optional["Wallet"]:
w = [wallet for wallet in self.wallets if wallet.id == wallet_id]
return w[0] if w else None
class Payment(BaseModel):
checking_id: str
pending: bool