tt-server/apps/core/models.py
jpt b7b6c56d0e
Some checks are pending
Lint / lint (push) Waiting to run
add core app skelly
2025-05-03 19:56:10 -05:00

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()