Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 6c1e92e3

Přidáno uživatelem Matěj Zeman před více než 2 roky(ů)

re #9425 Struktury upraveny dle vize. Endpointy rozděleny do souboru podle funkcionality.

Zobrazit rozdíly:

server/sql_app/models.py
13 13
    serial_number = Column(String, index=True, nullable=False)
14 14

  
15 15
    logs = relationship("USBLog", back_populates="device")
16
    licenses = relationship("DeviceLicense", back_populates="device_lic")
16 17

  
17 18

  
18 19
class USBLog(Base):
19 20
    __tablename__ = "usb_logs"
20 21

  
21 22
    id = Column(Integer, primary_key=True, index=True)
22
    username = Column(String, index=True, nullable=False)
23
    hostname = Column(String, index=True, nullable=False)
23
    pc_id = Column(Integer, ForeignKey("pc.id"))
24 24
    timestamp = Column(String, index=True, nullable=False)
25 25
    status = Column(String, index=True, nullable=False)
26 26
    device_id = Column(Integer, ForeignKey("devices.id"))
27 27

  
28 28
    device = relationship("Device", back_populates="logs")
29
    pc = relationship("PC", back_populates="logs_pc")
30

  
31

  
32
class License(Base):
33
    __tablename__ = "licenses"
34

  
35
    id = Column(Integer, primary_key=True, index=True)
36
    name = Column(String, index=True, nullable=False)
37
    expiration_date = Column(String, index=True, nullable=False)
38

  
39
    devices = relationship("DeviceLicense", back_populates="licenses")
40

  
41

  
42
class DeviceLicense(Base):
43
    __tablename__ = "devices_licenses"
44

  
45
    id = Column(Integer, primary_key=True, index=True)
46
    device_id = Column(Integer, ForeignKey("devices.id"))
47
    license_id = Column(Integer, ForeignKey("licenses.id"))
48
    assigned_datetime = Column(String, index=True, nullable=False)
49

  
50
    device_lic = relationship("Device", back_populates="licenses")
51
    licenses = relationship("License", back_populates="devices")
52

  
53

  
54
class PC(Base):
55
    __tablename__ = "pc"
56

  
57
    id = Column(Integer, primary_key=True, index=True)
58
    username = Column(String, index=True, nullable=False)
59
    hostname = Column(String, index=True, nullable=False)
60
    logs_pc = relationship("USBLog", back_populates="pc")

Také k dispozici: Unified diff