-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathmodels.py
More file actions
57 lines (45 loc) · 1.43 KB
/
models.py
File metadata and controls
57 lines (45 loc) · 1.43 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
55
56
57
from datetime import datetime, timezone
from pydantic import BaseModel, Field
class Switch(BaseModel):
amount: float = 0.0
duration: int = 0
pin: int = 0
comment: bool = False
variable: bool = False
label: str | None = None
class CreateBitcoinswitch(BaseModel):
title: str
wallet: str
currency: str
switches: list[Switch]
password: str | None = None
disabled: bool = False
disposable: bool = True
class Bitcoinswitch(BaseModel):
id: str
title: str
wallet: str
currency: str
switches: list[Switch]
password: str | None = None
disabled: bool = False
disposable: bool = True
created_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
updated_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
# obsolete field, do not use anymore
# should be deleted from the database in the future
key: str = ""
class BitcoinswitchPublic(BaseModel):
title: str
switches: list[Switch]
class BitcoinswitchPayment(BaseModel):
id: str
bitcoinswitch_id: str
payment_hash: str
pin: int
sats: int
created_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
updated_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
# TODO: deprecated do not use this field anymore
# should be deleted from the database in the future
payload: str = ""