diff --git a/apps/api/serializers.py b/apps/api/serializers.py index 40d5ff7..0d34cd0 100644 --- a/apps/api/serializers.py +++ b/apps/api/serializers.py @@ -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") diff --git a/apps/home/migrations/0017_trackedcontent_message_id.py b/apps/home/migrations/0017_trackedcontent_message_id.py new file mode 100644 index 0000000..7146037 --- /dev/null +++ b/apps/home/migrations/0017_trackedcontent_message_id.py @@ -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, + ), + ] diff --git a/apps/home/models.py b/apps/home/models.py index 7fa0e12..e1b065e 100644 --- a/apps/home/models.py +++ b/apps/home/models.py @@ -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(