Browse Source

Small refactoring to reduce duplicate code.

pull/111/head
Sebastian Stehle 9 years ago
parent
commit
6823102880
  1. 6
      src/Squidex.Domain.Apps.Read/Contents/GraphQL/Types/ContentGraphType.cs

6
src/Squidex.Domain.Apps.Read/Contents/GraphQL/Types/ContentGraphType.cs

@ -88,13 +88,15 @@ namespace Squidex.Domain.Apps.Read.Contents.GraphQL.Types
Description = $"The url to the the {schemaName} content." Description = $"The url to the the {schemaName} content."
}); });
if (schema.SchemaDef.Fields.Any(x => !x.IsHidden)) var dataType = new ContentDataGraphType(schema.SchemaDef, context);
if (dataType.Fields.Any())
{ {
AddField(new FieldType AddField(new FieldType
{ {
Name = "data", Name = "data",
Resolver = Resolver(x => x.Data), Resolver = Resolver(x => x.Data),
ResolvedType = new NonNullGraphType(new ContentDataGraphType(schema.SchemaDef, context)), ResolvedType = new NonNullGraphType(dataType),
Description = $"The data of the {schemaName} content." Description = $"The data of the {schemaName} content."
}); });
} }

Loading…
Cancel
Save