-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathmodels.py
More file actions
54 lines (37 loc) · 1.2 KB
/
models.py
File metadata and controls
54 lines (37 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from lnbits.helpers import urlsafe_short_hash
from pydantic import BaseModel, Field
class RelayStatus(BaseModel):
num_sent_events: int | None = 0
num_received_events: int | None = 0
error_counter: int | None = 0
error_list: list | None = []
notice_list: list | None = []
class Relay(BaseModel):
id: str | None = None
url: str | None = None
active: bool | None = None
connected: bool | None = Field(default=None, no_database=True)
connected_string: str | None = Field(default=None, no_database=True)
status: RelayStatus | None = Field(default=None, no_database=True)
ping: int | None = Field(default=None, no_database=True)
def _init__(self):
if not self.id:
self.id = urlsafe_short_hash()
class RelayDb(BaseModel):
id: str
url: str
active: bool | None = True
class TestMessage(BaseModel):
sender_private_key: str | None
reciever_public_key: str
message: str
class TestMessageResponse(BaseModel):
private_key: str
public_key: str
event_json: str
class Config(BaseModel):
private_ws: bool = True
public_ws: bool = False
class UserConfig(BaseModel):
owner_id: str
extra: Config = Config()