Skip to content

Commit

Permalink
fix: Only return valid taxonomy term types
Browse files Browse the repository at this point in the history
  • Loading branch information
josebui committed Sep 26, 2023
1 parent ee432e0 commit 1f9430d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions terraso_backend/apps/graphql/schema/taxnomy_terms.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

logger = structlog.get_logger(__name__)

VALID_TYPES = [key for (key, text) in TaxonomyTerm.TYPES]


class TaxonomyTermNode(DjangoObjectType):
id = graphene.ID(source="pk", required=True)
Expand All @@ -42,3 +44,7 @@ class Meta:
)
interfaces = (relay.Node,)
connection_class = TerrasoConnection

@classmethod
def get_queryset(cls, queryset, info):
return queryset.filter(type__in=VALID_TYPES)

0 comments on commit 1f9430d

Please sign in to comment.