Skip to content

Commit

Permalink
Avoid unwanted duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
XanderVertegaal committed Dec 18, 2024
1 parent b115871 commit 497f1e6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions backend/event/types/EpisodeType.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
from event.models import Episode, EpisodeCategory
from event.types.EpisodeCategoryType import EpisodeCategoryType
from person.models import AgentDescription
from space.models import SpaceDescription


class EpisodeType(EntityDescriptionType, DjangoObjectType):
categories = List(NonNull(EpisodeCategoryType), required=True)
agents = List(
NonNull("person.types.AgentDescriptionType.AgentDescriptionType"), required=True
)
spaces = List(NonNull("space.types.SpaceDescriptionType.SpaceDescriptionType"), required=True)

class Meta:
model = Episode
Expand Down Expand Up @@ -43,6 +45,12 @@ def resolve_agents(
# to that agent, for some reason.
return parent.agents.distinct()

@staticmethod
def resolve_spaces(
parent: Episode, info: ResolveInfo
) -> QuerySet[SpaceDescription]:
return parent.spaces.distinct()

@staticmethod
def resolve_categories(
parent: Episode, info: ResolveInfo
Expand Down

0 comments on commit 497f1e6

Please sign in to comment.