diff --git a/scoap3/articles/api/serializers.py b/scoap3/articles/api/serializers.py index d91b3066c..850672b1b 100644 --- a/scoap3/articles/api/serializers.py +++ b/scoap3/articles/api/serializers.py @@ -56,11 +56,12 @@ def to_representation(self, instance): class LegacyArticleSerializer(serializers.ModelSerializer): metadata = serializers.SerializerMethodField() updated = serializers.SerializerMethodField() + created = serializers.SerializerMethodField() id = serializers.SerializerMethodField() class Meta: model = Article - fields = ["id", "metadata", "updated"] + fields = ["id", "metadata", "updated", "created"] def get_id(self, obj): return obj.id @@ -168,6 +169,9 @@ def get_metadata(self, obj): def get_updated(self, obj): return obj._updated_at + def get_created(self, obj): + return obj._created_at + class ArticleDocumentSerializer(DocumentSerializer): class Meta: diff --git a/scoap3/articles/tests/test_record_views.py b/scoap3/articles/tests/test_record_views.py index b6d366e0d..bb92bc759 100644 --- a/scoap3/articles/tests/test_record_views.py +++ b/scoap3/articles/tests/test_record_views.py @@ -53,6 +53,7 @@ def test_get_record_json_structure(self, client, license, user): assert "id" in data["results"][0] assert "metadata" in data["results"][0] assert "updated" in data["results"][0] + assert "created" in data["results"][0] metadata = data["results"][0]["metadata"] assert "control_number" in metadata