22 lines
795 B
Python
22 lines
795 B
Python
import uuid
|
|
|
|
from django.db import models
|
|
|
|
|
|
class SensorDevice(models.Model):
|
|
sensor_uuid = models.UUIDField(default=uuid.uuid4, unique=True, editable=False)
|
|
device_identifier = models.CharField(max_length=255, unique=True)
|
|
device_name = models.CharField(max_length=255, blank=True)
|
|
handshake_token = models.CharField(max_length=255, blank=True)
|
|
metadata = models.JSONField(default=dict, blank=True)
|
|
translation_config = models.JSONField(default=dict, blank=True)
|
|
is_active = models.BooleanField(default=True)
|
|
created_at = models.DateTimeField(auto_now_add=True)
|
|
updated_at = models.DateTimeField(auto_now=True)
|
|
|
|
class Meta:
|
|
ordering = ["-created_at"]
|
|
|
|
def __str__(self) -> str:
|
|
return f"{self.device_identifier} ({self.sensor_uuid})"
|