1 |
54840605
|
matejzeman
|
from typing import List, Optional
|
2 |
|
|
|
3 |
|
|
from pydantic import BaseModel
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
class USBLogBase(BaseModel):
|
7 |
|
|
username: str
|
8 |
|
|
hostname: str
|
9 |
|
|
timestamp: str
|
10 |
|
|
status: str
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
class USBLogCreate(USBLogBase):
|
14 |
|
|
pass
|
15 |
|
|
|
16 |
|
|
|
17 |
|
|
class USBLog(USBLogBase):
|
18 |
|
|
id: int
|
19 |
|
|
device_id: int
|
20 |
|
|
|
21 |
|
|
class Config:
|
22 |
|
|
orm_mode = True
|
23 |
|
|
|
24 |
|
|
class DeviceBase(BaseModel):
|
25 |
|
|
vendor_id: int
|
26 |
|
|
product_id: int
|
27 |
|
|
|
28 |
|
|
|
29 |
|
|
class DeviceCreate(DeviceBase):
|
30 |
|
|
pass
|
31 |
|
|
|
32 |
|
|
|
33 |
|
|
class Device(DeviceBase):
|
34 |
|
|
id: int
|
35 |
|
|
logs: List[USBLog] = []
|
36 |
|
|
class Config:
|
37 |
|
|
orm_mode = True
|