receive interaction

This commit is contained in:
neodb dev 2023-12-27 09:23:41 -05:00 committed by Henri Dickson
parent 19f07240f2
commit 06e606d672
3 changed files with 28 additions and 1 deletions

View file

@ -229,6 +229,25 @@ class PiecePost(models.Model):
]
class PieceInteraction(models.Model):
piece = models.ForeignKey(Piece, on_delete=models.CASCADE)
interaction_type = models.CharField(max_length=50)
identity = models.ForeignKey(APIdentity, on_delete=models.CASCADE)
created_time = models.DateTimeField(default=timezone.now)
class Meta:
constraints = [
models.UniqueConstraint(
fields=["identity", "interaction_type", "piece"],
name="unique_interaction",
),
]
indexes = [
models.Index(fields=["identity", "interaction_type", "created_time"]),
models.Index(fields=["piece", "interaction_type", "created_time"]),
]
class Content(Piece):
owner = models.ForeignKey(APIdentity, on_delete=models.PROTECT)
visibility = models.PositiveSmallIntegerField(

@ -1 +1 @@
Subproject commit 86aca811daa19594dd37293d731a9a3fc1ced3e0
Subproject commit 32b1175ae3d45659e7962b393524019c6381a721

View file

@ -123,6 +123,14 @@ def post_deleted(pk, obj):
logger.debug(f"Matched remote piece {piece} has newer posts, not deleting")
def post_interacted(interaction_pk, interaction, post_pk, identity_pk):
pass
def post_uninteracted(interaction_pk, interaction, post_pk, identity_pk):
pass
def identity_fetched(pk):
try:
identity = Identity.objects.get(pk=pk)