From 800940e76f1a09a7d76d1ff929f4601cd6b9c3ba Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 1 Jul 2021 18:52:15 +0200 Subject: [PATCH] Cleanup. --- .../Types/Contents/ComponentGraphType.cs | 7 ++--- .../Types/Contents/ContentGraphType.cs | 27 ++++++++++--------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ComponentGraphType.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ComponentGraphType.cs index 436661a2d..35aca2e1d 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ComponentGraphType.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ComponentGraphType.cs @@ -21,14 +21,13 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Contents Description = $"The structure of the {schemaInfo.DisplayName} component schema."; - AddField(ContentFields.SchemaId); - AddResolvedInterface(builder.SharedTypes.ComponentInterface); - IsTypeOf = CheckType(schemaInfo.Schema.Id.ToString()); } public void Initialize(Builder builder, SchemaInfo schemaInfo) { + AddField(ContentFields.SchemaId); + foreach (var fieldInfo in schemaInfo.Fields) { if (fieldInfo.Field.IsComponentLike()) @@ -57,6 +56,8 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Contents }).WithSourceName(fieldInfo); } } + + AddResolvedInterface(builder.SharedTypes.ComponentInterface); } private static Func CheckType(string schemaId) diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ContentGraphType.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ContentGraphType.cs index 98363c24f..8de789aa7 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ContentGraphType.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ContentGraphType.cs @@ -21,6 +21,17 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Contents { schemaId = schemaInfo.Schema.Id; + IsTypeOf = CheckType; + } + + private bool CheckType(object value) + { + return value is IContentEntity content && content.SchemaId?.Id == schemaId; + } + + public void Initialize(Builder builder, SchemaInfo schemaInfo, IEnumerable allSchemas) + { + Name = schemaInfo.ContentType; AddField(ContentFields.Id); @@ -33,20 +44,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Contents AddField(ContentFields.LastModifiedByUser); AddField(ContentFields.Status); AddField(ContentFields.StatusColor); - AddResolvedInterface(builder.SharedTypes.ContentInterface); - - Description = $"The structure of a {schemaInfo.DisplayName} content type."; - IsTypeOf = CheckType; - } - - private bool CheckType(object value) - { - return value is IContentEntity content && content.SchemaId?.Id == schemaId; - } - - public void Initialize(Builder builder, SchemaInfo schemaInfo, IEnumerable allSchemas) - { AddField(new FieldType { Name = "url", @@ -85,6 +83,9 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Contents { AddReferencingQueries(builder, other); } + AddResolvedInterface(builder.SharedTypes.ContentInterface); + + Description = $"The structure of a {schemaInfo.DisplayName} content type."; } private void AddReferencingQueries(Builder builder, SchemaInfo referencingSchemaInfo)