1
|
from typing import List, Optional
|
2
|
from datetime import datetime, date
|
3
|
from pydantic import BaseModel
|
4
|
|
5
|
|
6
|
class DeviceLicenseBase(BaseModel):
|
7
|
device_id: int
|
8
|
license_id: int
|
9
|
assigned_datetime: str
|
10
|
|
11
|
|
12
|
class DeviceLicenseCreate(DeviceLicenseBase):
|
13
|
pass
|
14
|
|
15
|
|
16
|
class DeviceLicense(DeviceLicenseCreate):
|
17
|
"""
|
18
|
Class used for creating and reading devices_licenses entries
|
19
|
"""
|
20
|
id: int
|
21
|
|
22
|
class Config:
|
23
|
orm_mode = True
|
24
|
|
25
|
|
26
|
class USBLogBase(BaseModel):
|
27
|
timestamp: datetime
|
28
|
status: str
|
29
|
|
30
|
|
31
|
class USBLogCreate(USBLogBase):
|
32
|
pass
|
33
|
|
34
|
|
35
|
class USBLog(USBLogBase):
|
36
|
"""
|
37
|
Class used for creating and reading usb_logs entries
|
38
|
"""
|
39
|
id: int
|
40
|
device_id: int
|
41
|
pc_id: int
|
42
|
|
43
|
class Config:
|
44
|
orm_mode = True
|
45
|
|
46
|
|
47
|
class DeviceBase(BaseModel):
|
48
|
vendor_id: str
|
49
|
product_id: str
|
50
|
serial_number: str
|
51
|
|
52
|
|
53
|
class DeviceCreate(DeviceBase):
|
54
|
pass
|
55
|
|
56
|
|
57
|
class Device(DeviceCreate):
|
58
|
"""
|
59
|
Class used for creating and reading devices entries
|
60
|
"""
|
61
|
id: int
|
62
|
assigned: bool
|
63
|
logs: List[USBLog] = []
|
64
|
licenses: List[DeviceLicense] = []
|
65
|
|
66
|
class Config:
|
67
|
orm_mode = True
|
68
|
|
69
|
|
70
|
class LDLogBase(BaseModel):
|
71
|
timestamp: datetime
|
72
|
status: str
|
73
|
|
74
|
|
75
|
class LDLogCreate(LDLogBase):
|
76
|
pass
|
77
|
|
78
|
|
79
|
class LDLog(LDLogCreate):
|
80
|
"""
|
81
|
Class used for creating and reading ld_logs entries
|
82
|
"""
|
83
|
id: int
|
84
|
head_id: int
|
85
|
body_id: int
|
86
|
|
87
|
class Config:
|
88
|
orm_mode = True
|
89
|
|
90
|
|
91
|
class BodyDeviceBase(BaseModel):
|
92
|
serial_number: str
|
93
|
|
94
|
|
95
|
class BodyDeviceCreate(BodyDeviceBase):
|
96
|
pass
|
97
|
|
98
|
|
99
|
class BodyDevice(BodyDeviceCreate):
|
100
|
"""
|
101
|
Class used for creating and reading body_devices entries
|
102
|
"""
|
103
|
id: int
|
104
|
logs: List[LDLog] = []
|
105
|
|
106
|
class Config:
|
107
|
orm_mode = True
|
108
|
|
109
|
|
110
|
class HeadDeviceBase(BaseModel):
|
111
|
serial_number: str
|
112
|
|
113
|
|
114
|
class HeadDeviceCreate(HeadDeviceBase):
|
115
|
pass
|
116
|
|
117
|
|
118
|
class HeadDevice(HeadDeviceCreate):
|
119
|
"""
|
120
|
Class used for creating and reading head_devices entries
|
121
|
"""
|
122
|
id: int
|
123
|
logs: List[LDLog] = []
|
124
|
|
125
|
class Config:
|
126
|
orm_mode = True
|
127
|
|
128
|
|
129
|
class PCBase(BaseModel):
|
130
|
username: str
|
131
|
hostname: str
|
132
|
|
133
|
|
134
|
class PCCreate(PCBase):
|
135
|
pass
|
136
|
|
137
|
|
138
|
class PC(PCCreate):
|
139
|
"""
|
140
|
Class used for creating and reading pc entries
|
141
|
"""
|
142
|
id: int
|
143
|
assigned: bool
|
144
|
logs_pc: List[USBLog] = []
|
145
|
|
146
|
class Config:
|
147
|
orm_mode = True
|
148
|
|
149
|
|
150
|
class TeamBase(BaseModel):
|
151
|
name: str
|
152
|
|
153
|
|
154
|
class TeamCreate(TeamBase):
|
155
|
pass
|
156
|
|
157
|
|
158
|
class Team(TeamCreate):
|
159
|
"""
|
160
|
Class used for creating and reading team entries
|
161
|
"""
|
162
|
id: int
|
163
|
pcs: List[PC] = []
|
164
|
|
165
|
class Config:
|
166
|
orm_mode = True
|
167
|
|
168
|
|
169
|
class LicenseBase(BaseModel):
|
170
|
name: str
|
171
|
expiration_date: date
|
172
|
|
173
|
|
174
|
class LicenseCreate(LicenseBase):
|
175
|
pass
|
176
|
|
177
|
|
178
|
class License(LicenseCreate):
|
179
|
"""
|
180
|
Class used for creating and reading licenses entries
|
181
|
"""
|
182
|
id: int
|
183
|
devices: List[DeviceLicense] = []
|
184
|
|
185
|
class Config:
|
186
|
orm_mode = True
|
187
|
|
188
|
|
189
|
class USBTempBase(BaseModel):
|
190
|
"""
|
191
|
Class used for reading data from keyman detecting client messages
|
192
|
"""
|
193
|
username: str
|
194
|
hostname: str
|
195
|
timestamp: str
|
196
|
device: DeviceBase
|
197
|
status: str
|
198
|
|
199
|
|
200
|
class USBTempCreate(USBTempBase):
|
201
|
pass
|
202
|
|
203
|
|
204
|
class USBTemp(USBTempBase):
|
205
|
id: int
|
206
|
device_id: int
|
207
|
|
208
|
class Config:
|
209
|
orm_mode = True
|
210
|
|
211
|
|
212
|
class LDTempBase(BaseModel):
|
213
|
"""
|
214
|
Class used for reading data from debugger detecting client messages
|
215
|
"""
|
216
|
username: str
|
217
|
hostname: str
|
218
|
timestamp: str
|
219
|
head_device: HeadDeviceBase
|
220
|
body_device: BodyDeviceBase
|
221
|
status: str
|
222
|
|
223
|
|
224
|
class LDTempCreate(LDTempBase):
|
225
|
pass
|
226
|
|
227
|
|
228
|
class LDTemp(LDTempCreate):
|
229
|
id: int
|
230
|
head_id: int
|
231
|
body_id: int
|
232
|
|
233
|
class Config:
|
234
|
orm_mode = True
|