Skip to content

Commit

Permalink
Merge pull request #640 from NASA-IMPACT/639-expose-tree-path-via-api
Browse files Browse the repository at this point in the history
add tree root to the url serializer
  • Loading branch information
CarsonDavis authored Mar 1, 2024
2 parents 76abc6d + 681e78d commit e9f6a94
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sde_collections/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class CandidateURLAPISerializer(serializers.ModelSerializer):
document_type = serializers.SerializerMethodField()
title = serializers.SerializerMethodField()
file_extension = serializers.SerializerMethodField()
tree_root = serializers.SerializerMethodField()

class Meta:
model = CandidateURL
Expand All @@ -101,6 +102,7 @@ class Meta:
"document_type",
"hash",
"file_extension",
"tree_root",
)

def get_document_type(self, obj):
Expand All @@ -117,6 +119,9 @@ def get_title(self, obj):
def get_file_extension(self, obj):
return obj.fileext

def get_tree_root(self, obj):
return obj.collection.tree_root


class BasePatternSerializer(serializers.ModelSerializer):
match_pattern_type_display = serializers.CharField(source="get_match_pattern_type_display", read_only=True)
Expand Down

0 comments on commit e9f6a94

Please sign in to comment.