Projekt

Obecné

Profil

Stáhnout (1.78 KB) Statistiky
| Větev: | Tag: | Revize:
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
    id: int
18

    
19
    class Config:
20
        orm_mode = True
21

    
22

    
23
class USBLogBase(BaseModel):
24
    timestamp: datetime
25
    status: str
26

    
27

    
28
class USBLogCreate(USBLogBase):
29
    pass
30

    
31

    
32
class USBLog(USBLogBase):
33
    id: int
34
    device_id: int
35
    pc_id: int
36

    
37
    class Config:
38
        orm_mode = True
39

    
40

    
41
class DeviceBase(BaseModel):
42
    vendor_id: str
43
    product_id: str
44
    serial_number: str
45

    
46

    
47
class DeviceCreate(DeviceBase):
48
    pass
49

    
50

    
51
class Device(DeviceCreate):
52
    id: int
53
    assigned: bool
54
    logs: List[USBLog] = []
55
    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
    assigned: bool
73
    logs_pc: List[USBLog] = []
74

    
75
    class Config:
76
        orm_mode = True
77

    
78

    
79
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
class LicenseBase(BaseModel):
96
    name: str
97
    expiration_date: date
98

    
99

    
100
class LicenseCreate(LicenseBase):
101
    pass
102

    
103

    
104
class License(LicenseCreate):
105
    id: int
106
    devices: List[DeviceLicense] = []
107

    
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
(6-6/6)