1 |
aba60b70
|
Matej Zeman
|
from typing import List, Optional
|
2 |
99c92c11
|
Matej Zeman
|
from datetime import datetime, date
|
3 |
aba60b70
|
Matej Zeman
|
from pydantic import BaseModel
|
4 |
|
|
|
5 |
|
|
|
6 |
6c1e92e3
|
Matej Zeman
|
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 |
|
|
id: int
|
18 |
|
|
|
19 |
|
|
class Config:
|
20 |
|
|
orm_mode = True
|
21 |
|
|
|
22 |
|
|
|
23 |
aba60b70
|
Matej Zeman
|
class USBLogBase(BaseModel):
|
24 |
99c92c11
|
Matej Zeman
|
timestamp: datetime
|
25 |
aba60b70
|
Matej Zeman
|
status: str
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
class USBLogCreate(USBLogBase):
|
29 |
|
|
pass
|
30 |
|
|
|
31 |
|
|
|
32 |
|
|
class USBLog(USBLogBase):
|
33 |
|
|
id: int
|
34 |
|
|
device_id: int
|
35 |
6c1e92e3
|
Matej Zeman
|
pc_id: int
|
36 |
aba60b70
|
Matej Zeman
|
|
37 |
|
|
class Config:
|
38 |
|
|
orm_mode = True
|
39 |
|
|
|
40 |
|
|
|
41 |
|
|
class DeviceBase(BaseModel):
|
42 |
99c92c11
|
Matej Zeman
|
vendor_id: str
|
43 |
|
|
product_id: str
|
44 |
aba60b70
|
Matej Zeman
|
serial_number: str
|
45 |
|
|
|
46 |
|
|
|
47 |
|
|
class DeviceCreate(DeviceBase):
|
48 |
|
|
pass
|
49 |
|
|
|
50 |
|
|
|
51 |
99c92c11
|
Matej Zeman
|
class Device(DeviceCreate):
|
52 |
aba60b70
|
Matej Zeman
|
id: int
|
53 |
99c92c11
|
Matej Zeman
|
assigned: bool
|
54 |
aba60b70
|
Matej Zeman
|
logs: List[USBLog] = []
|
55 |
6c1e92e3
|
Matej Zeman
|
licenses: List[DeviceLicense] = []
|
56 |
|
|
|
57 |
|
|
class Config:
|
58 |
|
|
orm_mode = True
|
59 |
|
|
|
60 |
|
|
|
61 |
|
|
class PCBase(BaseModel):
|
62 |
|
|
username: str
|
63 |
|
|
hostname: str
|
64 |
|
|
|
65 |
|
|
|
66 |
|
|
class PCCreate(PCBase):
|
67 |
|
|
pass
|
68 |
|
|
|
69 |
|
|
|
70 |
|
|
class PC(PCCreate):
|
71 |
|
|
id: int
|
72 |
99c92c11
|
Matej Zeman
|
assigned: bool
|
73 |
6c1e92e3
|
Matej Zeman
|
logs_pc: List[USBLog] = []
|
74 |
|
|
|
75 |
|
|
class Config:
|
76 |
|
|
orm_mode = True
|
77 |
|
|
|
78 |
|
|
|
79 |
99c92c11
|
Matej Zeman
|
class TeamBase(BaseModel):
|
80 |
|
|
name: str
|
81 |
|
|
|
82 |
|
|
|
83 |
|
|
class TeamCreate(TeamBase):
|
84 |
|
|
pass
|
85 |
|
|
|
86 |
|
|
|
87 |
|
|
class Team(TeamCreate):
|
88 |
|
|
id: int
|
89 |
|
|
pcs: List[PC] = []
|
90 |
|
|
|
91 |
|
|
class Config:
|
92 |
|
|
orm_mode = True
|
93 |
|
|
|
94 |
|
|
|
95 |
6c1e92e3
|
Matej Zeman
|
class LicenseBase(BaseModel):
|
96 |
|
|
name: str
|
97 |
99c92c11
|
Matej Zeman
|
expiration_date: date
|
98 |
6c1e92e3
|
Matej Zeman
|
|
99 |
|
|
|
100 |
|
|
class LicenseCreate(LicenseBase):
|
101 |
|
|
pass
|
102 |
|
|
|
103 |
|
|
|
104 |
|
|
class License(LicenseCreate):
|
105 |
|
|
id: int
|
106 |
|
|
devices: List[DeviceLicense] = []
|
107 |
aba60b70
|
Matej Zeman
|
|
108 |
|
|
class Config:
|
109 |
|
|
orm_mode = True
|
110 |
|
|
|
111 |
|
|
|
112 |
|
|
class USBTempBase(BaseModel):
|
113 |
|
|
username: str
|
114 |
|
|
hostname: str
|
115 |
|
|
timestamp: str
|
116 |
|
|
device: DeviceBase
|
117 |
|
|
status: str
|
118 |
|
|
|
119 |
|
|
|
120 |
|
|
class USBTempCreate(USBTempBase):
|
121 |
|
|
pass
|
122 |
|
|
|
123 |
|
|
|
124 |
|
|
class USBTemp(USBTempBase):
|
125 |
|
|
id: int
|
126 |
|
|
device_id: int
|
127 |
|
|
|
128 |
|
|
class Config:
|
129 |
|
|
orm_mode = True
|