Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 99c92c11

Přidáno uživatelem Matěj Zeman před asi 2 roky(ů)

re #9429 Added class and funcionality for Teams table. Modified date parsing and storing. Modified View at /usb-logs/. Replaced "_" with "-" in all endpoints.

Zobrazit rozdíly:

server/sql_app/schemas.py
1 1
from typing import List, Optional
2

  
2
from datetime import datetime, date
3 3
from pydantic import BaseModel
4 4

  
5 5

  
6

  
7 6
class DeviceLicenseBase(BaseModel):
8 7
    device_id: int
9 8
    license_id: int
......
22 21

  
23 22

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

  
28 27

  
......
40 39

  
41 40

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

  
47 46

  
......
49 48
    pass
50 49

  
51 50

  
52
class Device(DeviceBase):
51
class Device(DeviceCreate):
53 52
    id: int
53
    assigned: bool
54 54
    logs: List[USBLog] = []
55 55
    licenses: List[DeviceLicense] = []
56 56

  
......
69 69

  
70 70
class PC(PCCreate):
71 71
    id: int
72
    assigned: bool
72 73
    logs_pc: List[USBLog] = []
73 74

  
74 75
    class Config:
75 76
        orm_mode = True
76 77

  
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

  
78 95
class LicenseBase(BaseModel):
79 96
    name: str
80
    expiration_date: str
97
    expiration_date: date
81 98

  
82 99

  
83 100
class LicenseCreate(LicenseBase):

Také k dispozici: Unified diff