Added pydantic to models
This commit is contained in:
parent
c525655c15
commit
8dea1e28f0
|
@ -1,7 +1,9 @@
|
|||
from typing import NamedTuple
|
||||
from sqlite3 import Row
|
||||
from pydantic import BaseModel
|
||||
#from typing import NamedTuple
|
||||
|
||||
|
||||
class AMilk(NamedTuple):
|
||||
class AMilk(BaseModel):
|
||||
id: str
|
||||
wallet: str
|
||||
lnurl: str
|
||||
|
|
|
@ -5,9 +5,11 @@ from lnbits import bolt11
|
|||
from lnbits.core.services import pay_invoice
|
||||
from . import db
|
||||
from .helpers import get_callback_url, LnurlValidationError
|
||||
from sqlite3 import Row
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class Bleskomat(NamedTuple):
|
||||
class Bleskomat(BaseModel):
|
||||
id: str
|
||||
wallet: str
|
||||
api_key_id: str
|
||||
|
@ -19,7 +21,7 @@ class Bleskomat(NamedTuple):
|
|||
fee: str
|
||||
|
||||
|
||||
class BleskomatLnurl(NamedTuple):
|
||||
class BleskomatLnurl(BaseModel):
|
||||
id: str
|
||||
bleskomat: str
|
||||
wallet: str
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import json
|
||||
|
||||
from sqlite3 import Row
|
||||
from typing import NamedTuple, Optional
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class Captcha(NamedTuple):
|
||||
class Captcha(BaseModel):
|
||||
id: str
|
||||
wallet: str
|
||||
url: str
|
||||
|
|
|
@ -5,9 +5,10 @@ from quart import url_for
|
|||
from lnurl import Lnurl, encode as lnurl_encode # type: ignore
|
||||
from lnurl.types import LnurlPayMetadata # type: ignore
|
||||
from lnurl.models import LnurlPaySuccessAction, UrlAction # type: ignore
|
||||
from sqlite3 import Row
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class Copilots(NamedTuple):
|
||||
class Copilots(BaseModel):
|
||||
id: str
|
||||
user: str
|
||||
title: str
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
from typing import NamedTuple
|
||||
from sqlite3 import Row
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class Indexers(NamedTuple):
|
||||
class Indexers(BaseModel):
|
||||
id: str
|
||||
wallet: str
|
||||
shopname: str
|
||||
|
@ -15,7 +16,7 @@ class Indexers(NamedTuple):
|
|||
email: str
|
||||
|
||||
|
||||
class Products(NamedTuple):
|
||||
class Products(BaseModel):
|
||||
id: str
|
||||
wallet: str
|
||||
product: str
|
||||
|
@ -26,7 +27,7 @@ class Products(NamedTuple):
|
|||
quantity: int
|
||||
|
||||
|
||||
class Orders(NamedTuple):
|
||||
class Orders(BaseModel):
|
||||
id: str
|
||||
productid: str
|
||||
wallet: str
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
from typing import NamedTuple
|
||||
from sqlite3 import Row
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class Jukebox(NamedTuple):
|
||||
class Jukebox(BaseModel):
|
||||
id: str
|
||||
user: str
|
||||
title: str
|
||||
|
@ -22,7 +22,7 @@ class Jukebox(NamedTuple):
|
|||
return cls(**dict(row))
|
||||
|
||||
|
||||
class JukeboxPayment(NamedTuple):
|
||||
class JukeboxPayment(BaseModel):
|
||||
payment_hash: str
|
||||
juke_id: str
|
||||
song_id: str
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
import json
|
||||
from quart import url_for
|
||||
from typing import NamedTuple, Optional
|
||||
from typing import Optional
|
||||
from lnurl import Lnurl, encode as lnurl_encode # type: ignore
|
||||
from lnurl.types import LnurlPayMetadata # type: ignore
|
||||
from lnurl.models import LnurlPaySuccessAction, UrlAction # type: ignore
|
||||
from sqlite3 import Row
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class Livestream(NamedTuple):
|
||||
class Livestream(BaseModel):
|
||||
id: int
|
||||
wallet: str
|
||||
fee_pct: int
|
||||
|
@ -18,7 +19,7 @@ class Livestream(NamedTuple):
|
|||
return lnurl_encode(url)
|
||||
|
||||
|
||||
class Track(NamedTuple):
|
||||
class Track(BaseModel):
|
||||
id: int
|
||||
download_url: str
|
||||
price_msat: int
|
||||
|
@ -74,7 +75,7 @@ class Track(NamedTuple):
|
|||
)
|
||||
|
||||
|
||||
class Producer(NamedTuple):
|
||||
class Producer(BaseModel):
|
||||
id: int
|
||||
user: str
|
||||
wallet: str
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from typing import NamedTuple
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class Forms(NamedTuple):
|
||||
class Forms(BaseModel):
|
||||
id: str
|
||||
wallet: str
|
||||
name: str
|
||||
|
@ -13,7 +12,7 @@ class Forms(NamedTuple):
|
|||
time: int
|
||||
|
||||
|
||||
class Tickets(NamedTuple):
|
||||
class Tickets(BaseModel):
|
||||
id: str
|
||||
form: str
|
||||
email: str
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import json
|
||||
from urllib.parse import urlparse, urlunparse, parse_qs, urlencode, ParseResult
|
||||
from quart import url_for
|
||||
from typing import NamedTuple, Optional, Dict
|
||||
from sqlite3 import Row
|
||||
from typing import Optional, Dict
|
||||
from lnbits.lnurl import encode as lnurl_encode # type: ignore
|
||||
from lnurl.types import LnurlPayMetadata # type: ignore
|
||||
from sqlite3 import Row
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class PayLink(NamedTuple):
|
||||
class PayLink(BaseModel):
|
||||
id: int
|
||||
wallet: str
|
||||
description: str
|
||||
|
|
|
@ -3,17 +3,17 @@ import base64
|
|||
import hashlib
|
||||
from collections import OrderedDict
|
||||
from quart import url_for
|
||||
from typing import NamedTuple, Optional, List, Dict
|
||||
from typing import Optional, List, Dict
|
||||
from lnurl import encode as lnurl_encode # type: ignore
|
||||
from lnurl.types import LnurlPayMetadata # type: ignore
|
||||
from lnurl.models import LnurlPaySuccessAction, UrlAction # type: ignore
|
||||
|
||||
from pydantic import BaseModel
|
||||
from .helpers import totp
|
||||
|
||||
shop_counters: Dict = {}
|
||||
|
||||
|
||||
class ShopCounter(object):
|
||||
class ShopCounter(BaseModel):
|
||||
fulfilled_payments: OrderedDict
|
||||
counter: int
|
||||
|
||||
|
@ -54,7 +54,7 @@ class ShopCounter(object):
|
|||
return word
|
||||
|
||||
|
||||
class Shop(NamedTuple):
|
||||
class Shop(BaseModel):
|
||||
id: int
|
||||
wallet: str
|
||||
method: str
|
||||
|
@ -77,7 +77,7 @@ class Shop(NamedTuple):
|
|||
return ""
|
||||
|
||||
|
||||
class Item(NamedTuple):
|
||||
class Item(BaseModel):
|
||||
shop: int
|
||||
id: int
|
||||
name: str
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import json
|
||||
|
||||
from sqlite3 import Row
|
||||
from typing import NamedTuple, Optional
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class Paywall(NamedTuple):
|
||||
class Paywall(BaseModel):
|
||||
id: str
|
||||
wallet: str
|
||||
url: str
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from sqlite3 import Row
|
||||
from typing import NamedTuple
|
||||
from pydantic import BaseModel
|
||||
import time
|
||||
|
||||
|
||||
class Charges(NamedTuple):
|
||||
class Charges(BaseModel):
|
||||
id: str
|
||||
user: str
|
||||
description: str
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
from typing import NamedTuple
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class Target(NamedTuple):
|
||||
class Target(BaseModel):
|
||||
wallet: str
|
||||
source: str
|
||||
percent: int
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
from sqlite3 import Row
|
||||
from typing import NamedTuple, Optional
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class Donation(NamedTuple):
|
||||
class Donation(BaseModel):
|
||||
"""A Donation simply contains all the necessary information about a
|
||||
user's donation to a streamer
|
||||
"""
|
||||
|
@ -22,7 +23,7 @@ class Donation(NamedTuple):
|
|||
return cls(**dict(row))
|
||||
|
||||
|
||||
class Service(NamedTuple):
|
||||
class Service(BaseModel):
|
||||
"""A Service represents an integration with a third-party API
|
||||
|
||||
Currently, Streamlabs is the only supported Service.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from typing import NamedTuple
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
class Domains(NamedTuple):
|
||||
class Domains(BaseModel):
|
||||
id: str
|
||||
wallet: str
|
||||
domain: str
|
||||
|
@ -15,7 +15,7 @@ class Domains(NamedTuple):
|
|||
allowed_record_types: str
|
||||
|
||||
|
||||
class Subdomains(NamedTuple):
|
||||
class Subdomains(BaseModel):
|
||||
id: str
|
||||
wallet: str
|
||||
domain: str
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
from typing import NamedTuple
|
||||
from sqlite3 import Row
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class Users(NamedTuple):
|
||||
class Users(BaseModel):
|
||||
id: str
|
||||
name: str
|
||||
admin: str
|
||||
|
@ -10,7 +10,7 @@ class Users(NamedTuple):
|
|||
password: str
|
||||
|
||||
|
||||
class Wallets(NamedTuple):
|
||||
class Wallets(BaseModel):
|
||||
id: str
|
||||
admin: str
|
||||
name: str
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
from sqlite3 import Row
|
||||
from typing import NamedTuple
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class Wallets(NamedTuple):
|
||||
class Wallets(BaseModel):
|
||||
id: str
|
||||
user: str
|
||||
masterpub: str
|
||||
|
@ -15,7 +15,7 @@ class Wallets(NamedTuple):
|
|||
return cls(**dict(row))
|
||||
|
||||
|
||||
class Mempool(NamedTuple):
|
||||
class Mempool(BaseModel):
|
||||
user: str
|
||||
endpoint: str
|
||||
|
||||
|
@ -24,7 +24,7 @@ class Mempool(NamedTuple):
|
|||
return cls(**dict(row))
|
||||
|
||||
|
||||
class Addresses(NamedTuple):
|
||||
class Addresses(BaseModel):
|
||||
id: str
|
||||
address: str
|
||||
wallet: str
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
from quart import url_for
|
||||
from lnurl import Lnurl, LnurlWithdrawResponse, encode as lnurl_encode # type: ignore
|
||||
from sqlite3 import Row
|
||||
from typing import NamedTuple
|
||||
from pydantic import BaseModel
|
||||
import shortuuid # type: ignore
|
||||
|
||||
|
||||
class WithdrawLink(NamedTuple):
|
||||
class WithdrawLink(BaseModel):
|
||||
id: str
|
||||
wallet: str
|
||||
title: str
|
||||
|
@ -67,7 +67,7 @@ class WithdrawLink(NamedTuple):
|
|||
)
|
||||
|
||||
|
||||
class HashCheck(NamedTuple):
|
||||
class HashCheck(BaseModel):
|
||||
id: str
|
||||
lnurl_id: str
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user