From 83da94de7db326dcdf30391be777af53d3095b1b Mon Sep 17 00:00:00 2001 From: Luka van der Plas Date: Thu, 19 Sep 2024 12:12:26 +0200 Subject: [PATCH] interface inheritance --- backend/core/types/EntityDescriptionType.py | 2 + backend/core/types/NamedType.py | 1 + backend/core/types/entity.py | 2 +- backend/event/types/EpisodeAgentType.py | 4 +- backend/event/types/EpisodeEntityLink.py | 4 +- backend/event/types/EpisodeGiftType.py | 4 +- backend/event/types/EpisodeLetterType.py | 4 +- backend/event/types/EpisodeSpaceType.py | 4 +- backend/event/types/EpisodeType.py | 1 + backend/letter/types/GiftDescriptionType.py | 3 +- backend/letter/types/LetterDescriptionType.py | 3 +- backend/person/types/AgentDescriptionType.py | 3 +- backend/space/types/SpaceDescriptionType.py | 3 +- frontend/generated/graphql.ts | 53 ++++++++----------- frontend/generated/schema.graphql | 42 ++++++--------- .../gift-identification-form.component.ts | 6 +-- .../letter-identification-form.component.ts | 6 +-- 17 files changed, 59 insertions(+), 86 deletions(-) diff --git a/backend/core/types/EntityDescriptionType.py b/backend/core/types/EntityDescriptionType.py index 56af6189..f89db74b 100644 --- a/backend/core/types/EntityDescriptionType.py +++ b/backend/core/types/EntityDescriptionType.py @@ -6,6 +6,7 @@ from user.models import User from user.types.UserType import UserType +from core.types.entity import EntityDescription as EntityDescriptionInterface class EntityDescriptionType(NamedType, AbstractDjangoObjectType): @@ -27,6 +28,7 @@ class Meta: "page", "contributors", ] + NamedType.fields() + interfaces = (EntityDescriptionInterface,) @staticmethod def resolve_contributors( diff --git a/backend/core/types/NamedType.py b/backend/core/types/NamedType.py index 39b7b40e..e9148a75 100644 --- a/backend/core/types/NamedType.py +++ b/backend/core/types/NamedType.py @@ -10,6 +10,7 @@ class NamedType(AbstractDjangoObjectType): """ name = graphene.NonNull(graphene.String) + description = graphene.NonNull(graphene.String) class Meta: model = Named diff --git a/backend/core/types/entity.py b/backend/core/types/entity.py index 93099226..2710b211 100644 --- a/backend/core/types/entity.py +++ b/backend/core/types/entity.py @@ -8,7 +8,7 @@ class Entity(graphene.Enum): SPACE = "space" -class EntityInterface(graphene.Interface): +class EntityDescription(graphene.Interface): id = graphene.NonNull(graphene.ID) name = graphene.String() description = graphene.String() diff --git a/backend/event/types/EpisodeAgentType.py b/backend/event/types/EpisodeAgentType.py index 48ac29df..14991f89 100644 --- a/backend/event/types/EpisodeAgentType.py +++ b/backend/event/types/EpisodeAgentType.py @@ -3,12 +3,12 @@ from core.types.DescriptionFieldType import DescriptionFieldType from event.models import EpisodeAgent -from core.types.entity import Entity, EntityInterface +from core.types.entity import Entity, EntityDescription from event.types.EpisodeEntityLink import EpisodeEntityLink from core.types.DescriptionFieldType import SourceMentionEnum class EpisodeAgentType(DescriptionFieldType, DjangoObjectType): - entity = NonNull(EntityInterface) + entity = NonNull(EntityDescription) entity_type = NonNull(Entity) class Meta: diff --git a/backend/event/types/EpisodeEntityLink.py b/backend/event/types/EpisodeEntityLink.py index 2dc264e0..bb7e27bd 100644 --- a/backend/event/types/EpisodeEntityLink.py +++ b/backend/event/types/EpisodeEntityLink.py @@ -1,13 +1,13 @@ from graphene import ID, NonNull, String, Interface from core.types.DescriptionFieldType import SourceMentionEnum from event.types.EpisodeType import EpisodeType -from core.types.entity import Entity, EntityInterface +from core.types.entity import Entity, EntityDescription class EpisodeEntityLink(Interface): id = NonNull(ID) episode = NonNull(EpisodeType) entity_type = NonNull(Entity) - entity = NonNull(EntityInterface) + entity = NonNull(EntityDescription) source_mention = NonNull(SourceMentionEnum) note = String() diff --git a/backend/event/types/EpisodeGiftType.py b/backend/event/types/EpisodeGiftType.py index 9c76abc3..82606b23 100644 --- a/backend/event/types/EpisodeGiftType.py +++ b/backend/event/types/EpisodeGiftType.py @@ -1,14 +1,14 @@ from graphene import NonNull from graphene_django import DjangoObjectType -from core.types.entity import Entity, EntityInterface +from core.types.entity import Entity, EntityDescription from core.types.DescriptionFieldType import DescriptionFieldType, SourceMentionEnum from event.models import EpisodeGift from event.types.EpisodeEntityLink import EpisodeEntityLink class EpisodeGiftType(DescriptionFieldType, DjangoObjectType): - entity = NonNull(EntityInterface) + entity = NonNull(EntityDescription) entity_type = NonNull(Entity) class Meta: diff --git a/backend/event/types/EpisodeLetterType.py b/backend/event/types/EpisodeLetterType.py index a63e486a..97b3deff 100644 --- a/backend/event/types/EpisodeLetterType.py +++ b/backend/event/types/EpisodeLetterType.py @@ -2,12 +2,12 @@ from graphene_django import DjangoObjectType from core.types.DescriptionFieldType import DescriptionFieldType, SourceMentionEnum -from core.types.entity import Entity, EntityInterface +from core.types.entity import Entity, EntityDescription from event.models import EpisodeLetter from event.types.EpisodeEntityLink import EpisodeEntityLink class EpisodeLetterType(DescriptionFieldType, DjangoObjectType): - entity = NonNull(EntityInterface) + entity = NonNull(EntityDescription) entity_type = NonNull(Entity) class Meta: diff --git a/backend/event/types/EpisodeSpaceType.py b/backend/event/types/EpisodeSpaceType.py index 24b74bb4..c85c1967 100644 --- a/backend/event/types/EpisodeSpaceType.py +++ b/backend/event/types/EpisodeSpaceType.py @@ -2,12 +2,12 @@ from graphene_django import DjangoObjectType from core.types.DescriptionFieldType import DescriptionFieldType, SourceMentionEnum -from core.types.entity import Entity, EntityInterface +from core.types.entity import Entity, EntityDescription from event.models import EpisodeSpace from event.types.EpisodeEntityLink import EpisodeEntityLink class EpisodeSpaceType(DescriptionFieldType, DjangoObjectType): - entity = NonNull(EntityInterface) + entity = NonNull(EntityDescription) entity_type = NonNull(Entity) class Meta: diff --git a/backend/event/types/EpisodeType.py b/backend/event/types/EpisodeType.py index 3383d6e4..eee68c82 100644 --- a/backend/event/types/EpisodeType.py +++ b/backend/event/types/EpisodeType.py @@ -21,6 +21,7 @@ class Meta: "letters", "spaces", ] + EntityDescriptionType.fields() + interfaces = EntityDescriptionType._meta.interfaces @classmethod def get_queryset( diff --git a/backend/letter/types/GiftDescriptionType.py b/backend/letter/types/GiftDescriptionType.py index 8451d6ec..c69cf8d3 100644 --- a/backend/letter/types/GiftDescriptionType.py +++ b/backend/letter/types/GiftDescriptionType.py @@ -6,7 +6,6 @@ from letter.models import GiftCategory, GiftDescription, GiftDescriptionCategory from letter.types.GiftDescriptionCategoryType import GiftDescriptionCategoryType from letter.types.GiftCategoryType import GiftCategoryType -from core.types.entity import EntityInterface from event.types.EpisodeGiftType import EpisodeGiftType from event.models import EpisodeGift @@ -24,7 +23,7 @@ class Meta: "categories", "episodes", ] + EntityDescriptionType.fields() - interfaces = (EntityInterface,) + interfaces = EntityDescriptionType._meta.interfaces @classmethod def get_queryset( diff --git a/backend/letter/types/LetterDescriptionType.py b/backend/letter/types/LetterDescriptionType.py index f1e6878a..3cee4396 100644 --- a/backend/letter/types/LetterDescriptionType.py +++ b/backend/letter/types/LetterDescriptionType.py @@ -6,7 +6,6 @@ from letter.models import LetterCategory, LetterDescription, LetterDescriptionCategory from letter.types.LetterCategoryType import LetterCategoryType from letter.types.LetterDescriptionCategoryType import LetterDescriptionCategoryType -from core.types.entity import EntityInterface from event.models import EpisodeLetter from event.types.EpisodeLetterType import EpisodeLetterType @@ -24,7 +23,7 @@ class Meta: "categories", "episodes", ] + EntityDescriptionType.fields() - interfaces = (EntityInterface,) + interfaces = EntityDescriptionType._meta.interfaces @classmethod def get_queryset( diff --git a/backend/person/types/AgentDescriptionType.py b/backend/person/types/AgentDescriptionType.py index ba0a8fb1..9f7e2650 100644 --- a/backend/person/types/AgentDescriptionType.py +++ b/backend/person/types/AgentDescriptionType.py @@ -10,7 +10,6 @@ from person.types.PersonReferenceType import PersonReferenceType from event.types.EpisodeAgentType import EpisodeAgentType from event.models import EpisodeAgent -from core.types.entity import EntityInterface class AgentDescriptionType(EntityDescriptionType, DjangoObjectType): @@ -31,7 +30,7 @@ class Meta: "location", "episodes", ] + EntityDescriptionType.fields() - interfaces = (EntityInterface,) + interfaces = EntityDescriptionType._meta.interfaces @classmethod def get_queryset( diff --git a/backend/space/types/SpaceDescriptionType.py b/backend/space/types/SpaceDescriptionType.py index eebc53f2..9f7d42d1 100644 --- a/backend/space/types/SpaceDescriptionType.py +++ b/backend/space/types/SpaceDescriptionType.py @@ -18,7 +18,6 @@ from space.types.StructureType import StructureType from space.types.SettlementFieldType import SettlementFieldType from space.types.StructureFieldType import StructureFieldType -from core.types.entity import EntityInterface from event.types.EpisodeSpaceType import EpisodeSpaceType from event.models import EpisodeSpace @@ -41,7 +40,7 @@ class Meta: "structures", "episodes", ] + EntityDescriptionType.fields() - interfaces = (EntityInterface,) + interfaces = EntityDescriptionType._meta.interfaces @classmethod def get_queryset( diff --git a/frontend/generated/graphql.ts b/frontend/generated/graphql.ts index 59e5250d..b78420b6 100644 --- a/frontend/generated/graphql.ts +++ b/frontend/generated/graphql.ts @@ -40,7 +40,7 @@ export type AgentDescriptionLocationType = { sourceMention: SourceMention; }; -export type AgentDescriptionType = EntityInterface & { +export type AgentDescriptionType = EntityDescription & { __typename?: 'AgentDescriptionType'; /** The book in the source */ book: Scalars['String']['output']; @@ -48,7 +48,7 @@ export type AgentDescriptionType = EntityInterface & { chapter: Scalars['String']['output']; contributors: Array; describes: Array; - description?: Maybe; + description: Scalars['String']['output']; /** Relevant (Latin) terminology used to describe this entity in the source text */ designators: Array; episodes: Array; @@ -185,7 +185,7 @@ export enum Entity { Space = 'SPACE' } -export type EntityInterface = { +export type EntityDescription = { description?: Maybe; id: Scalars['ID']['output']; name?: Maybe; @@ -195,7 +195,7 @@ export type EpisodeAgentType = EpisodeEntityLink & { __typename?: 'EpisodeAgentType'; agent: AgentDescriptionType; certainty: Certainty; - entity: EntityInterface; + entity: EntityDescription; entityType: Entity; episode: EpisodeType; id: Scalars['ID']['output']; @@ -205,14 +205,13 @@ export type EpisodeAgentType = EpisodeEntityLink & { export type EpisodeCategoryType = { __typename?: 'EpisodeCategoryType'; - /** Longer description to help identify this object */ description: Scalars['String']['output']; id: Scalars['ID']['output']; name: Scalars['String']['output']; }; export type EpisodeEntityLink = { - entity: EntityInterface; + entity: EntityDescription; entityType: Entity; episode: EpisodeType; id: Scalars['ID']['output']; @@ -223,7 +222,7 @@ export type EpisodeEntityLink = { export type EpisodeGiftType = EpisodeEntityLink & { __typename?: 'EpisodeGiftType'; certainty: Certainty; - entity: EntityInterface; + entity: EntityDescription; entityType: Entity; episode: EpisodeType; gift: GiftDescriptionType; @@ -235,7 +234,7 @@ export type EpisodeGiftType = EpisodeEntityLink & { export type EpisodeLetterType = EpisodeEntityLink & { __typename?: 'EpisodeLetterType'; certainty: Certainty; - entity: EntityInterface; + entity: EntityDescription; entityType: Entity; episode: EpisodeType; id: Scalars['ID']['output']; @@ -247,7 +246,7 @@ export type EpisodeLetterType = EpisodeEntityLink & { export type EpisodeSpaceType = EpisodeEntityLink & { __typename?: 'EpisodeSpaceType'; certainty: Certainty; - entity: EntityInterface; + entity: EntityDescription; entityType: Entity; episode: EpisodeType; id: Scalars['ID']['output']; @@ -256,7 +255,7 @@ export type EpisodeSpaceType = EpisodeEntityLink & { space: SpaceDescriptionType; }; -export type EpisodeType = { +export type EpisodeType = EntityDescription & { __typename?: 'EpisodeType'; /** agents involved in this episode */ agents: Array; @@ -266,7 +265,6 @@ export type EpisodeType = { /** The chapter or chapters in the source */ chapter: Scalars['String']['output']; contributors: Array; - /** Longer description to help identify this object */ description: Scalars['String']['output']; /** Relevant (Latin) terminology used to describe this entity in the source text */ designators: Array; @@ -315,7 +313,6 @@ export type GiftCategorisationInput = { export type GiftCategoryType = { __typename?: 'GiftCategoryType'; - /** Longer description to help identify this object */ description: Scalars['String']['output']; id: Scalars['ID']['output']; name: Scalars['String']['output']; @@ -332,7 +329,7 @@ export type GiftDescriptionCategoryType = { sourceMention: SourceMention; }; -export type GiftDescriptionType = EntityInterface & { +export type GiftDescriptionType = EntityDescription & { __typename?: 'GiftDescriptionType'; /** The book in the source */ book: Scalars['String']['output']; @@ -341,7 +338,7 @@ export type GiftDescriptionType = EntityInterface & { /** The chapter or chapters in the source */ chapter: Scalars['String']['output']; contributors: Array; - description?: Maybe; + description: Scalars['String']['output']; /** Relevant (Latin) terminology used to describe this entity in the source text */ designators: Array; episodes: Array; @@ -360,7 +357,6 @@ export type HistoricalPersonType = { contributors: Array; dateOfBirth?: Maybe; dateOfDeath?: Maybe; - /** Longer description to help identify this object */ description: Scalars['String']['output']; id: Scalars['ID']['output']; /** Whether this entity is identifiable (i.e. can be cross-referenced between descriptions), or a generic description */ @@ -394,7 +390,7 @@ export type LetterDescriptionCategoryType = { sourceMention: SourceMention; }; -export type LetterDescriptionType = EntityInterface & { +export type LetterDescriptionType = EntityDescription & { __typename?: 'LetterDescriptionType'; /** The book in the source */ book: Scalars['String']['output']; @@ -403,7 +399,7 @@ export type LetterDescriptionType = EntityInterface & { /** The chapter or chapters in the source */ chapter: Scalars['String']['output']; contributors: Array; - description?: Maybe; + description: Scalars['String']['output']; /** Relevant (Latin) terminology used to describe this entity in the source text */ designators: Array; episodes: Array; @@ -717,7 +713,6 @@ export type RegionFieldType = { export type RegionType = { __typename?: 'RegionType'; contributors: Array; - /** Longer description to help identify this object */ description: Scalars['String']['output']; id: Scalars['ID']['output']; /** Whether this entity is identifiable (i.e. can be cross-referenced between descriptions), or a generic description */ @@ -741,7 +736,6 @@ export type SettlementFieldType = { export type SettlementType = { __typename?: 'SettlementType'; contributors: Array; - /** Longer description to help identify this object */ description: Scalars['String']['output']; id: Scalars['ID']['output']; /** Whether this entity is identifiable (i.e. can be cross-referenced between descriptions), or a generic description */ @@ -808,14 +802,14 @@ export type SourceWrittenDateType = { yearUpper: Scalars['Int']['output']; }; -export type SpaceDescriptionType = EntityInterface & { +export type SpaceDescriptionType = EntityDescription & { __typename?: 'SpaceDescriptionType'; /** The book in the source */ book: Scalars['String']['output']; /** The chapter or chapters in the source */ chapter: Scalars['String']['output']; contributors: Array; - description?: Maybe; + description: Scalars['String']['output']; /** Relevant (Latin) terminology used to describe this entity in the source text */ designators: Array; episodes: Array; @@ -881,7 +875,6 @@ export type StructureFieldType = { export type StructureType = { __typename?: 'StructureType'; contributors: Array; - /** Longer description to help identify this object */ description: Scalars['String']['output']; id: Scalars['ID']['output']; /** Whether this entity is identifiable (i.e. can be cross-referenced between descriptions), or a generic description */ @@ -1066,14 +1059,14 @@ export type DataEntryAgentIdentificationQueryVariables = Exact<{ }>; -export type DataEntryAgentIdentificationQuery = { __typename?: 'Query', agentDescription?: { __typename?: 'AgentDescriptionType', id: string, name: string, description?: string | null, isGroup: boolean } | null }; +export type DataEntryAgentIdentificationQuery = { __typename?: 'Query', agentDescription?: { __typename?: 'AgentDescriptionType', id: string, name: string, description: string, isGroup: boolean } | null }; export type DataEntryAgentQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; -export type DataEntryAgentQuery = { __typename?: 'Query', agentDescription?: { __typename?: 'AgentDescriptionType', id: string, name: string, description?: string | null, isGroup: boolean, source: { __typename?: 'SourceType', id: string, name: string } } | null }; +export type DataEntryAgentQuery = { __typename?: 'Query', agentDescription?: { __typename?: 'AgentDescriptionType', id: string, name: string, description: string, isGroup: boolean, source: { __typename?: 'SourceType', id: string, name: string } } | null }; export type DataEntryUpdateAgentMutationVariables = Exact<{ input: UpdateAgentInput; @@ -1160,7 +1153,7 @@ export type DataEntryGiftIdentificationQueryVariables = Exact<{ }>; -export type DataEntryGiftIdentificationQuery = { __typename?: 'Query', giftDescription?: { __typename?: 'GiftDescriptionType', id: string, name: string, description?: string | null } | null }; +export type DataEntryGiftIdentificationQuery = { __typename?: 'Query', giftDescription?: { __typename?: 'GiftDescriptionType', id: string, name: string, description: string } | null }; export type DataEntryGiftSourceTextQueryVariables = Exact<{ id: Scalars['ID']['input']; @@ -1174,7 +1167,7 @@ export type DataEntryGiftFormQueryVariables = Exact<{ }>; -export type DataEntryGiftFormQuery = { __typename?: 'Query', giftDescription?: { __typename?: 'GiftDescriptionType', id: string, name: string, description?: string | null, source: { __typename?: 'SourceType', id: string, name: string } } | null }; +export type DataEntryGiftFormQuery = { __typename?: 'Query', giftDescription?: { __typename?: 'GiftDescriptionType', id: string, name: string, description: string, source: { __typename?: 'SourceType', id: string, name: string } } | null }; export type DataEntryUpdateGiftMutationVariables = Exact<{ giftData: UpdateGiftInput; @@ -1200,7 +1193,7 @@ export type DataEntryLetterIdentificationQueryVariables = Exact<{ }>; -export type DataEntryLetterIdentificationQuery = { __typename?: 'Query', letterDescription?: { __typename?: 'LetterDescriptionType', id: string, name: string, description?: string | null } | null }; +export type DataEntryLetterIdentificationQuery = { __typename?: 'Query', letterDescription?: { __typename?: 'LetterDescriptionType', id: string, name: string, description: string } | null }; export type DataEntryLetterSourceTextQueryVariables = Exact<{ id: Scalars['ID']['input']; @@ -1214,7 +1207,7 @@ export type DataEntryLetterFormQueryVariables = Exact<{ }>; -export type DataEntryLetterFormQuery = { __typename?: 'Query', letterDescription?: { __typename?: 'LetterDescriptionType', id: string, name: string, description?: string | null, source: { __typename?: 'SourceType', id: string, name: string } } | null }; +export type DataEntryLetterFormQuery = { __typename?: 'Query', letterDescription?: { __typename?: 'LetterDescriptionType', id: string, name: string, description: string, source: { __typename?: 'SourceType', id: string, name: string } } | null }; export type DataEntryUpdateLetterMutationVariables = Exact<{ letterData: UpdateLetterInput; @@ -1228,7 +1221,7 @@ export type DataEntrySpaceDescriptionQueryVariables = Exact<{ }>; -export type DataEntrySpaceDescriptionQuery = { __typename?: 'Query', spaceDescription?: { __typename?: 'SpaceDescriptionType', id: string, name: string, description?: string | null, source: { __typename?: 'SourceType', id: string, name: string } } | null }; +export type DataEntrySpaceDescriptionQuery = { __typename?: 'Query', spaceDescription?: { __typename?: 'SpaceDescriptionType', id: string, name: string, description: string, source: { __typename?: 'SourceType', id: string, name: string } } | null }; export type DataEntryEpisodeEntityLinkQueryVariables = Exact<{ entity: Scalars['ID']['input']; @@ -1237,7 +1230,7 @@ export type DataEntryEpisodeEntityLinkQueryVariables = Exact<{ }>; -export type DataEntryEpisodeEntityLinkQuery = { __typename?: 'Query', episodeEntityLink?: { __typename?: 'EpisodeAgentType', id: string, note?: string | null, sourceMention: SourceMention, episode: { __typename?: 'EpisodeType', id: string, name: string }, entity: { __typename?: 'AgentDescriptionType', id: string, name: string } | { __typename?: 'GiftDescriptionType', id: string, name: string } | { __typename?: 'LetterDescriptionType', id: string, name: string } | { __typename?: 'SpaceDescriptionType', id: string, name: string } } | { __typename?: 'EpisodeGiftType', id: string, note?: string | null, sourceMention: SourceMention, episode: { __typename?: 'EpisodeType', id: string, name: string }, entity: { __typename?: 'AgentDescriptionType', id: string, name: string } | { __typename?: 'GiftDescriptionType', id: string, name: string } | { __typename?: 'LetterDescriptionType', id: string, name: string } | { __typename?: 'SpaceDescriptionType', id: string, name: string } } | { __typename?: 'EpisodeLetterType', id: string, note?: string | null, sourceMention: SourceMention, episode: { __typename?: 'EpisodeType', id: string, name: string }, entity: { __typename?: 'AgentDescriptionType', id: string, name: string } | { __typename?: 'GiftDescriptionType', id: string, name: string } | { __typename?: 'LetterDescriptionType', id: string, name: string } | { __typename?: 'SpaceDescriptionType', id: string, name: string } } | { __typename?: 'EpisodeSpaceType', id: string, note?: string | null, sourceMention: SourceMention, episode: { __typename?: 'EpisodeType', id: string, name: string }, entity: { __typename?: 'AgentDescriptionType', id: string, name: string } | { __typename?: 'GiftDescriptionType', id: string, name: string } | { __typename?: 'LetterDescriptionType', id: string, name: string } | { __typename?: 'SpaceDescriptionType', id: string, name: string } } | null }; +export type DataEntryEpisodeEntityLinkQuery = { __typename?: 'Query', episodeEntityLink?: { __typename?: 'EpisodeAgentType', id: string, note?: string | null, sourceMention: SourceMention, episode: { __typename?: 'EpisodeType', id: string, name: string }, entity: { __typename?: 'AgentDescriptionType', id: string, name: string } | { __typename?: 'EpisodeType', id: string, name: string } | { __typename?: 'GiftDescriptionType', id: string, name: string } | { __typename?: 'LetterDescriptionType', id: string, name: string } | { __typename?: 'SpaceDescriptionType', id: string, name: string } } | { __typename?: 'EpisodeGiftType', id: string, note?: string | null, sourceMention: SourceMention, episode: { __typename?: 'EpisodeType', id: string, name: string }, entity: { __typename?: 'AgentDescriptionType', id: string, name: string } | { __typename?: 'EpisodeType', id: string, name: string } | { __typename?: 'GiftDescriptionType', id: string, name: string } | { __typename?: 'LetterDescriptionType', id: string, name: string } | { __typename?: 'SpaceDescriptionType', id: string, name: string } } | { __typename?: 'EpisodeLetterType', id: string, note?: string | null, sourceMention: SourceMention, episode: { __typename?: 'EpisodeType', id: string, name: string }, entity: { __typename?: 'AgentDescriptionType', id: string, name: string } | { __typename?: 'EpisodeType', id: string, name: string } | { __typename?: 'GiftDescriptionType', id: string, name: string } | { __typename?: 'LetterDescriptionType', id: string, name: string } | { __typename?: 'SpaceDescriptionType', id: string, name: string } } | { __typename?: 'EpisodeSpaceType', id: string, note?: string | null, sourceMention: SourceMention, episode: { __typename?: 'EpisodeType', id: string, name: string }, entity: { __typename?: 'AgentDescriptionType', id: string, name: string } | { __typename?: 'EpisodeType', id: string, name: string } | { __typename?: 'GiftDescriptionType', id: string, name: string } | { __typename?: 'LetterDescriptionType', id: string, name: string } | { __typename?: 'SpaceDescriptionType', id: string, name: string } } | null }; export type DataEntryUpdateEpisodeEntityLinkMutationVariables = Exact<{ input: UpdateEpisodeEntityLinkInput; diff --git a/frontend/generated/schema.graphql b/frontend/generated/schema.graphql index 54a6bf2e..bfd06295 100644 --- a/frontend/generated/schema.graphql +++ b/frontend/generated/schema.graphql @@ -22,7 +22,7 @@ type AgentDescriptionLocationType { sourceMention: SourceMention! } -type AgentDescriptionType implements EntityInterface { +type AgentDescriptionType implements EntityDescription { """The book in the source""" book: String! @@ -30,7 +30,7 @@ type AgentDescriptionType implements EntityInterface { chapter: String! contributors: [UserType!]! describes: [HistoricalPersonType!]! - description: String + description: String! """ Relevant (Latin) terminology used to describe this entity in the source text @@ -162,7 +162,7 @@ enum Entity { SPACE } -interface EntityInterface { +interface EntityDescription { description: String id: ID! name: String @@ -171,7 +171,7 @@ interface EntityInterface { type EpisodeAgentType implements EpisodeEntityLink { agent: AgentDescriptionType! certainty: Certainty! - entity: EntityInterface! + entity: EntityDescription! entityType: Entity! episode: EpisodeType! id: ID! @@ -180,14 +180,13 @@ type EpisodeAgentType implements EpisodeEntityLink { } type EpisodeCategoryType { - """Longer description to help identify this object""" description: String! id: ID! name: String! } interface EpisodeEntityLink { - entity: EntityInterface! + entity: EntityDescription! entityType: Entity! episode: EpisodeType! id: ID! @@ -197,7 +196,7 @@ interface EpisodeEntityLink { type EpisodeGiftType implements EpisodeEntityLink { certainty: Certainty! - entity: EntityInterface! + entity: EntityDescription! entityType: Entity! episode: EpisodeType! gift: GiftDescriptionType! @@ -208,7 +207,7 @@ type EpisodeGiftType implements EpisodeEntityLink { type EpisodeLetterType implements EpisodeEntityLink { certainty: Certainty! - entity: EntityInterface! + entity: EntityDescription! entityType: Entity! episode: EpisodeType! id: ID! @@ -219,7 +218,7 @@ type EpisodeLetterType implements EpisodeEntityLink { type EpisodeSpaceType implements EpisodeEntityLink { certainty: Certainty! - entity: EntityInterface! + entity: EntityDescription! entityType: Entity! episode: EpisodeType! id: ID! @@ -228,7 +227,7 @@ type EpisodeSpaceType implements EpisodeEntityLink { space: SpaceDescriptionType! } -type EpisodeType { +type EpisodeType implements EntityDescription { """agents involved in this episode""" agents: [AgentDescriptionType!]! @@ -239,8 +238,6 @@ type EpisodeType { """The chapter or chapters in the source""" chapter: String! contributors: [UserType!]! - - """Longer description to help identify this object""" description: String! """ @@ -299,7 +296,6 @@ input GiftCategorisationInput { } type GiftCategoryType { - """Longer description to help identify this object""" description: String! id: ID! name: String! @@ -316,7 +312,7 @@ type GiftDescriptionCategoryType { sourceMention: SourceMention! } -type GiftDescriptionType implements EntityInterface { +type GiftDescriptionType implements EntityDescription { """The book in the source""" book: String! categories: [GiftCategoryType!]! @@ -325,7 +321,7 @@ type GiftDescriptionType implements EntityInterface { """The chapter or chapters in the source""" chapter: String! contributors: [UserType!]! - description: String + description: String! """ Relevant (Latin) terminology used to describe this entity in the source text @@ -349,8 +345,6 @@ type HistoricalPersonType { contributors: [UserType!]! dateOfBirth: PersonDateOfBirthType dateOfDeath: PersonDateOfDeathType - - """Longer description to help identify this object""" description: String! id: ID! @@ -386,7 +380,7 @@ type LetterDescriptionCategoryType { sourceMention: SourceMention! } -type LetterDescriptionType implements EntityInterface { +type LetterDescriptionType implements EntityDescription { """The book in the source""" book: String! categories: [LetterCategoryType!]! @@ -395,7 +389,7 @@ type LetterDescriptionType implements EntityInterface { """The chapter or chapters in the source""" chapter: String! contributors: [UserType!]! - description: String + description: String! """ Relevant (Latin) terminology used to describe this entity in the source text @@ -561,8 +555,6 @@ type RegionFieldType { type RegionType { contributors: [UserType!]! - - """Longer description to help identify this object""" description: String! id: ID! @@ -589,8 +581,6 @@ type SettlementFieldType { type SettlementType { contributors: [UserType!]! - - """Longer description to help identify this object""" description: String! id: ID! @@ -675,14 +665,14 @@ type SourceWrittenDateType { yearUpper: Int! } -type SpaceDescriptionType implements EntityInterface { +type SpaceDescriptionType implements EntityDescription { """The book in the source""" book: String! """The chapter or chapters in the source""" chapter: String! contributors: [UserType!]! - description: String + description: String! """ Relevant (Latin) terminology used to describe this entity in the source text @@ -760,8 +750,6 @@ type StructureFieldType { type StructureType { contributors: [UserType!]! - - """Longer description to help identify this object""" description: String! id: ID! diff --git a/frontend/src/app/data-entry/gift-form/gift-identification-form/gift-identification-form.component.ts b/frontend/src/app/data-entry/gift-form/gift-identification-form/gift-identification-form.component.ts index 51d679db..c92e7c79 100644 --- a/frontend/src/app/data-entry/gift-form/gift-identification-form/gift-identification-form.component.ts +++ b/frontend/src/app/data-entry/gift-form/gift-identification-form/gift-identification-form.component.ts @@ -99,11 +99,7 @@ export class GiftIdentificationFormComponent implements OnInit { if (!gift) { return; } - const value = { - name: gift.name, - description: gift.description || '', - }; - this.form.patchValue(value, { + this.form.patchValue(gift, { emitEvent: false, onlySelf: true, }); diff --git a/frontend/src/app/data-entry/letter-form/letter-identification-form/letter-identification-form.component.ts b/frontend/src/app/data-entry/letter-form/letter-identification-form/letter-identification-form.component.ts index f2b7f3fe..a2ccdbce 100644 --- a/frontend/src/app/data-entry/letter-form/letter-identification-form/letter-identification-form.component.ts +++ b/frontend/src/app/data-entry/letter-form/letter-identification-form/letter-identification-form.component.ts @@ -100,11 +100,7 @@ export class LetterIdentificationFormComponent implements OnInit { if (!letter) { return; } - const value = { - name: letter.name, - description: letter.description || '', - } - this.form.patchValue(value, { + this.form.patchValue(letter, { emitEvent: false, onlySelf: true, });