21 lines
621 B
Python
21 lines
621 B
Python
from django.db import models
|
|
from ..accounts.models import User
|
|
|
|
|
|
class Thing(models.Model):
|
|
thing_id = models.PositiveIntegerField()
|
|
user = models.ForeignKey(User, related_name="things", on_delete=models.CASCADE)
|
|
data = models.JSONField()
|
|
created_at = models.DateTimeField()
|
|
synced_at = models.DateTimeField()
|
|
deleted = models.BooleanField()
|
|
|
|
class Meta:
|
|
unique_together = ("thing_id", "user_id")
|
|
|
|
|
|
class ThingEdit(models.Model):
|
|
thing = models.ForeignKey(Thing, related_name="edits", on_delete=models.CASCADE)
|
|
data = models.JSONField()
|
|
timestamp = models.DateTimeField()
|