2024-06-12 07:32:49 +00:00
|
|
|
from django.db import models
|
2024-07-15 14:23:14 +00:00
|
|
|
from utils.constants import STR_SM_SIZE, STR_EXTEND_SIZE
|
2024-06-12 07:32:49 +00:00
|
|
|
from user.models import User
|
|
|
|
from device.models import Computer, Component
|
|
|
|
|
|
|
|
# Create your models here.
|
|
|
|
|
|
|
|
|
|
|
|
class Snapshot(models.Model):
|
|
|
|
class SoftWare(models.TextChoices):
|
|
|
|
WORKBENCH= "Workbench"
|
|
|
|
|
|
|
|
class Severity(models.IntegerChoices):
|
|
|
|
Info = 0, "Info"
|
|
|
|
Notice = 1, "Notice"
|
|
|
|
Warning = 2, "Warning"
|
|
|
|
Error = 3, "Error"
|
|
|
|
|
|
|
|
created = models.DateTimeField(auto_now_add=True)
|
|
|
|
software = models.CharField(max_length=STR_SM_SIZE, choices=SoftWare, default=SoftWare.WORKBENCH)
|
2024-07-11 15:40:45 +00:00
|
|
|
uuid = models.UUIDField(unique=True)
|
2024-06-12 07:32:49 +00:00
|
|
|
version = models.CharField(max_length=STR_SM_SIZE)
|
|
|
|
sid = models.CharField(max_length=STR_SM_SIZE)
|
|
|
|
settings_version = models.CharField(max_length=STR_SM_SIZE)
|
|
|
|
is_server_erase = models.BooleanField(default=False)
|
|
|
|
severity = models.SmallIntegerField(choices=Severity, default=Severity.Info)
|
|
|
|
end_time = models.DateTimeField()
|
|
|
|
owner = models.ForeignKey(User, on_delete=models.CASCADE)
|
|
|
|
computer = models.ForeignKey(Computer, on_delete=models.CASCADE)
|
|
|
|
components = models.ManyToManyField(Component)
|
2024-07-01 10:17:23 +00:00
|
|
|
|
2024-07-15 14:23:14 +00:00
|
|
|
|
|
|
|
class Annotation(models.Model):
|
|
|
|
created = models.DateTimeField(auto_now_add=True)
|
|
|
|
uuid = models.UUIDField(unique=True)
|
|
|
|
owner = models.ForeignKey(User, on_delete=models.CASCADE)
|
|
|
|
key = models.CharField(max_length=STR_EXTEND_SIZE)
|
|
|
|
value = models.CharField(max_length=STR_EXTEND_SIZE)
|
|
|
|
|