lnbits-legend/lnbits/extensions/tpos/models.py

26 lines
485 B
Python
Raw Normal View History

2021-10-06 14:49:00 +01:00
from sqlite3 import Row
from typing import Optional
2021-10-18 10:58:09 +01:00
from fastapi import Query
2021-10-06 19:43:57 +01:00
from pydantic import BaseModel
2021-10-06 14:49:00 +01:00
2021-10-06 19:43:57 +01:00
class CreateTposData(BaseModel):
name: str
currency: str
tip_options: str = Query(None)
tip_wallet: str = Query(None)
2021-10-06 19:43:57 +01:00
2021-10-17 18:33:29 +01:00
2021-10-06 19:43:57 +01:00
class TPoS(BaseModel):
2021-10-06 14:49:00 +01:00
id: str
wallet: str
name: str
currency: str
tip_options: Optional[str]
tip_wallet: Optional[str]
2021-10-06 14:49:00 +01:00
@classmethod
def from_row(cls, row: Row) -> "TPoS":
return cls(**dict(row))