forked from lnbits/lncalendar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.py
62 lines (48 loc) · 1.24 KB
/
models.py
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
58
59
60
61
62
from typing import Optional
from fastapi import Query
from pydantic import BaseModel
class CreateSchedule(BaseModel):
wallet: str = Query(...)
name: str = Query(...)
start_day: int = Query(..., ge=0, le=6)
end_day: int = Query(..., ge=0, le=6)
start_time: str = Query(...)
end_time: str = Query(...)
amount: int = Query(..., ge=1)
class CreateUnavailableTime(BaseModel):
start_time: str = Query(...)
end_time: str = Query(...)
schedule: str = Query(...)
class CreateAppointment(BaseModel):
name: str = Query(...)
email: str = Query(None)
info: str = Query(None)
start_time: str = Query(...)
end_time: str = Query(...)
schedule: str = Query(...)
class Schedule(BaseModel):
id: str
wallet: str
name: str
start_day: int
end_day: int
start_time: str
end_time: str
amount: int
@property
def availabe_days(self):
return [i for i in range(self.start_day, self.end_day + 1)]
class UnavailableTime(BaseModel):
id: str
start_time: str
end_time: str
schedule: str
class Appointment(BaseModel):
id: str
name: str
email: Optional[str]
info: Optional[str]
start_time: str
end_time: str
schedule: str
paid: bool