-
Notifications
You must be signed in to change notification settings - Fork 0
/
schemas.py
91 lines (54 loc) · 1.23 KB
/
schemas.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
from typing import List, Union
from pydantic import BaseModel
import pandas as pd
class MeasurementBase(BaseModel):
starttime: str
endtime: str
energy: int
unit: str
building_name: str
class Config:
orm_mode = True
class MeasurementCreate(MeasurementBase):
pass
class Measurement(MeasurementBase):
class Config:
orm_mode = True
class BuildingBase(BaseModel):
name: str
location: str
is_pv_installed: bool
class Config:
orm_mode = True
class BuildingCreate(BuildingBase):
pass
class Building(BuildingBase):
id: int
username = str
measurements: List[MeasurementBase]
class Config:
orm_mode = True
class UserBase(BaseModel):
email: str
class UserCreate(UserBase):
username: str
password: str
class User(UserBase):
id: int
is_active: bool
buildings: List[BuildingBase]
class Config:
orm_mode = True
class UserDB(User):
hashed_password: str
class Config:
orm_mode = True
class Token(BaseModel):
token: str
token_type: str
class Config:
orm_mode = True
class TokenData(BaseModel):
username: Union[str, None]
class Config:
orm_mode = True