message id on tracked content

This commit is contained in:
Corban-Lee Jones 2024-07-15 21:29:20 +01:00
parent 48743eadd8
commit 8d527092cc
3 changed files with 33 additions and 2 deletions

View File

@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
import logging
from urllib.parse import unquote
from rest_framework import serializers
@ -183,8 +184,17 @@ class TrackedContentSerializer_GET(DynamicModelSerializer):
class Meta:
model = TrackedContent
fields = ("id", "guid", "title", "url", "subscription", "channel_id", "blocked", "creation_datetime")
fields = ("id", "guid", "title", "url", "subscription", "channel_id", "message_id", "blocked", "creation_datetime")
# def to_representation(self, instance):
# representation = super().to_representation(instance)
# log.info(representation.get("guid", "nothing"))
# if 'guid' in representation:
# representation['guid'] = unquote(representation['guid'])
# log.info(representation.get("guid", "nothing"))
# return representation
class TrackedContentSerializer_POST(DynamicModelSerializer):
"""
Serializer for the TrackedContent model.
@ -192,4 +202,4 @@ class TrackedContentSerializer_POST(DynamicModelSerializer):
class Meta:
model = TrackedContent
fields = ("id", "guid", "title", "url", "subscription", "channel_id", "blocked", "creation_datetime")
fields = ("id", "guid", "title", "url", "subscription", "channel_id", "message_id", "blocked", "creation_datetime")

View File

@ -0,0 +1,19 @@
# Generated by Django 5.0.4 on 2024-07-11 21:59
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0016_alter_filter_matching_algorithm_and_more'),
]
operations = [
migrations.AddField(
model_name='trackedcontent',
name='message_id',
field=models.CharField(max_length=128),
preserve_default=False,
),
]

View File

@ -287,6 +287,8 @@ class TrackedContent(models.Model):
channel_id = models.CharField(max_length=128)
message_id = models.CharField(max_length=128)
blocked = models.BooleanField(default=False)
creation_datetime = models.DateTimeField(