Browse Source

Minor optimizations.

pull/222/head
Sebastian Stehle 8 years ago
parent
commit
bc130340cb
  1. 34
      src/Squidex.Domain.Apps.Entities/Contents/GraphQL/GraphQLModel.cs
  2. 67
      src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/AllTypes.cs
  3. 64
      src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/AppMutationsGraphType.cs
  4. 50
      src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/AppQueriesGraphType.cs
  5. 34
      src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/AssetGraphType.cs
  6. 2
      src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/AssetsResultGraphType.cs
  7. 2
      src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/CommandVersionGraphType.cs
  8. 2
      src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/ContentDataChangedResultGraphType.cs
  9. 3
      src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/ContentDataGraphInputType.cs
  10. 3
      src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/ContentDataGraphType.cs
  11. 16
      src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/ContentGraphType.cs
  12. 2
      src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/ContentsResultGraphType.cs
  13. 4
      src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/GeolocationInputGraphType.cs

34
src/Squidex.Domain.Apps.Entities/Contents/GraphQL/GraphQLModel.cs

@ -54,35 +54,35 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL
{
{
typeof(StringField),
new StringGraphType()
AllTypes.String
},
{
typeof(BooleanField),
new BooleanGraphType()
AllTypes.Boolean
},
{
typeof(NumberField),
new FloatGraphType()
AllTypes.Boolean
},
{
typeof(DateTimeField),
new DateGraphType()
AllTypes.Date
},
{
typeof(GeolocationField),
new GeolocationInputGraphType()
AllTypes.GeolocationInput
},
{
typeof(TagsField),
new ListGraphType(new StringGraphType())
AllTypes.ListOfNonNullString
},
{
typeof(AssetsField),
new ListGraphType(new GuidGraphType())
AllTypes.ListOfNonNullGuid
},
{
typeof(ReferencesField),
new ListGraphType(new GuidGraphType())
AllTypes.ListOfNonNullGuid
}
};
@ -90,31 +90,31 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL
{
{
typeof(StringField),
field => ResolveDefault("String")
field => ResolveDefault(AllTypes.NoopString)
},
{
typeof(BooleanField),
field => ResolveDefault("Boolean")
field => ResolveDefault(AllTypes.NoopBoolean)
},
{
typeof(NumberField),
field => ResolveDefault("Float")
field => ResolveDefault(AllTypes.NoopFloat)
},
{
typeof(DateTimeField),
field => ResolveDefault("Date")
field => ResolveDefault(AllTypes.NoopDate)
},
{
typeof(JsonField),
field => ResolveDefault("Json")
field => ResolveDefault(AllTypes.NoopJson)
},
{
typeof(GeolocationField),
field => ResolveDefault("Geolocation")
field => ResolveDefault(AllTypes.NoopGeolocation)
},
{
typeof(TagsField),
field => ResolveDefault("String")
field => ResolveDefault(AllTypes.NoopTags)
},
{
typeof(AssetsField),
@ -144,9 +144,9 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL
}
}
private static (IGraphType ResolveType, IFieldResolver Resolver) ResolveDefault(string name)
private static (IGraphType ResolveType, IFieldResolver Resolver) ResolveDefault(IGraphType type)
{
return (new NoopGraphType(name), new FuncFieldResolver<ContentFieldData, object>(c => c.Source.GetOrDefault(c.FieldName)));
return (type, new FuncFieldResolver<ContentFieldData, object>(c => c.Source.GetOrDefault(c.FieldName)));
}
public IFieldResolver ResolveAssetUrl()

67
src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/AllTypes.cs

@ -0,0 +1,67 @@
// ==========================================================================
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex UG (haftungsbeschraenkt)
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using GraphQL.Types;
namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
{
public static class AllTypes
{
public static readonly Type None = typeof(NoopGraphType);
public static readonly IGraphType Int = new IntGraphType();
public static readonly IGraphType Guid = new GuidGraphType();
public static readonly IGraphType Date = new DateGraphType();
public static readonly IGraphType Float = new FloatGraphType();
public static readonly IGraphType String = new StringGraphType();
public static readonly IGraphType Boolean = new BooleanGraphType();
public static readonly IGraphType NonNullInt = new NonNullGraphType(new IntGraphType());
public static readonly IGraphType NonNullGuid = new NonNullGraphType(new GuidGraphType());
public static readonly IGraphType NonNullDate = new NonNullGraphType(new DateGraphType());
public static readonly IGraphType NonNullFloat = new NonNullGraphType(new FloatGraphType());
public static readonly IGraphType NonNullString = new NonNullGraphType(new StringGraphType());
public static readonly IGraphType NonNullBoolean = new NonNullGraphType(new BooleanGraphType());
public static readonly IGraphType ListOfNonNullGuid = new ListGraphType(new NonNullGraphType(new GuidGraphType()));
public static readonly IGraphType ListOfNonNullString = new ListGraphType(new NonNullGraphType(new StringGraphType()));
public static readonly IGraphType NoopInt = new NoopGraphType("Int");
public static readonly IGraphType NoopGuid = new NoopGraphType("Guid");
public static readonly IGraphType NoopDate = new NoopGraphType("Date");
public static readonly IGraphType NoopJson = new NoopGraphType("Json");
public static readonly IGraphType NoopTags = new NoopGraphType("Tags");
public static readonly IGraphType NoopFloat = new NoopGraphType("Float");
public static readonly IGraphType NoopString = new NoopGraphType("String");
public static readonly IGraphType NoopBoolean = new NoopGraphType("Boolean");
public static readonly IGraphType NoopGeolocation = new NoopGraphType("Geolocation");
public static readonly IGraphType CommandVersion = new CommandVersionGraphType();
public static readonly IGraphType GeolocationInput = new GeolocationInputGraphType();
}
}

64
src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/AppMutationsGraphType.cs

@ -56,24 +56,26 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
Name = $"create{schemaType}Content",
Arguments = new QueryArguments
{
new QueryArgument(typeof(BooleanGraphType))
{
Name = "publish",
Description = "Set to true to autopublish content.",
DefaultValue = false
},
new QueryArgument(typeof(NoopGraphType))
new QueryArgument(AllTypes.None)
{
Name = "data",
Description = $"The data for the {schemaName} content.",
DefaultValue = null,
ResolvedType = new NonNullGraphType(inputType),
},
new QueryArgument(typeof(IntGraphType))
new QueryArgument(AllTypes.None)
{
Name = "publish",
Description = "Set to true to autopublish content.",
DefaultValue = false,
ResolvedType = AllTypes.Boolean
},
new QueryArgument(AllTypes.None)
{
Name = "expectedVersion",
Description = "The expected version",
DefaultValue = EtagVersion.Any
DefaultValue = EtagVersion.Any,
ResolvedType = AllTypes.Int
}
},
ResolvedType = new NonNullGraphType(contentType),
@ -102,24 +104,26 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
Name = $"update{schemaType}Content",
Arguments = new QueryArguments
{
new QueryArgument(typeof(NonNullGraphType<GuidGraphType>))
new QueryArgument(AllTypes.None)
{
Name = "id",
Description = $"The id of the {schemaName} content (GUID)",
DefaultValue = string.Empty
DefaultValue = string.Empty,
ResolvedType = AllTypes.NonNullGuid
},
new QueryArgument(typeof(NoopGraphType))
new QueryArgument(AllTypes.None)
{
Name = "data",
Description = $"The data for the {schemaName} content.",
DefaultValue = null,
ResolvedType = new NonNullGraphType(inputType),
},
new QueryArgument(typeof(IntGraphType))
new QueryArgument(AllTypes.None)
{
Name = "expectedVersion",
Description = "The expected version",
DefaultValue = EtagVersion.Any
DefaultValue = EtagVersion.Any,
ResolvedType = AllTypes.Int
}
},
ResolvedType = new NonNullGraphType(resultType),
@ -146,24 +150,26 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
Name = $"patch{schemaType}Content",
Arguments = new QueryArguments
{
new QueryArgument(typeof(NonNullGraphType<GuidGraphType>))
new QueryArgument(AllTypes.None)
{
Name = "id",
Description = $"The id of the {schemaName} content (GUID)",
DefaultValue = string.Empty
DefaultValue = string.Empty,
ResolvedType = AllTypes.NonNullGuid
},
new QueryArgument(typeof(NoopGraphType))
new QueryArgument(AllTypes.None)
{
Name = "data",
Description = $"The data for the {schemaName} content.",
DefaultValue = null,
ResolvedType = new NonNullGraphType(inputType),
},
new QueryArgument(typeof(IntGraphType))
new QueryArgument(AllTypes.None)
{
Name = "expectedVersion",
Description = "The expected version",
DefaultValue = EtagVersion.Any
DefaultValue = EtagVersion.Any,
ResolvedType = AllTypes.Int
}
},
ResolvedType = new NonNullGraphType(resultType),
@ -189,7 +195,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
{
Name = $"publish{schemaType}Content",
Arguments = CreateIdArguments(schemaName),
ResolvedType = new NonNullGraphType(new CommandVersionGraphType()),
ResolvedType = AllTypes.CommandVersion,
Resolver = ResolveAsync((c, publish) =>
{
var contentId = c.GetArgument<Guid>("id");
@ -208,7 +214,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
{
Name = $"unpublish{schemaType}Content",
Arguments = CreateIdArguments(schemaName),
ResolvedType = new NonNullGraphType(new CommandVersionGraphType()),
ResolvedType = AllTypes.CommandVersion,
Resolver = ResolveAsync((c, publish) =>
{
var contentId = c.GetArgument<Guid>("id");
@ -227,7 +233,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
{
Name = $"archive{schemaType}Content",
Arguments = CreateIdArguments(schemaName),
ResolvedType = new NonNullGraphType(new CommandVersionGraphType()),
ResolvedType = AllTypes.CommandVersion,
Resolver = ResolveAsync((c, publish) =>
{
var contentId = c.GetArgument<Guid>("id");
@ -246,7 +252,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
{
Name = $"restore{schemaType}Content",
Arguments = CreateIdArguments(schemaName),
ResolvedType = new NonNullGraphType(new CommandVersionGraphType()),
ResolvedType = AllTypes.CommandVersion,
Resolver = ResolveAsync((c, publish) =>
{
var contentId = c.GetArgument<Guid>("id");
@ -265,7 +271,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
{
Name = $"delete{schemaType}Content",
Arguments = CreateIdArguments(schemaName),
ResolvedType = new NonNullGraphType(new CommandVersionGraphType()),
ResolvedType = AllTypes.CommandVersion,
Resolver = ResolveAsync((c, publish) =>
{
var contentId = c.GetArgument<Guid>("id");
@ -282,17 +288,19 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
{
return new QueryArguments
{
new QueryArgument(typeof(GuidGraphType))
new QueryArgument(AllTypes.None)
{
Name = "id",
Description = $"The id of the {schemaName} content (GUID)",
DefaultValue = string.Empty
DefaultValue = string.Empty,
ResolvedType = AllTypes.NonNullGuid
},
new QueryArgument(typeof(IntGraphType))
new QueryArgument(AllTypes.None)
{
Name = "expectedVersion",
Description = "The expected version",
DefaultValue = EtagVersion.Any
DefaultValue = EtagVersion.Any,
ResolvedType = AllTypes.Int
}
};
}

50
src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/AppQueriesGraphType.cs

@ -143,11 +143,12 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
{
return new QueryArguments
{
new QueryArgument(typeof(NonNullGraphType<GuidGraphType>))
new QueryArgument(AllTypes.None)
{
Name = "id",
Description = "The id of the asset (GUID).",
DefaultValue = string.Empty
DefaultValue = string.Empty,
ResolvedType = AllTypes.NonNullGuid
}
};
}
@ -156,11 +157,12 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
{
return new QueryArguments
{
new QueryArgument(typeof(NonNullGraphType<GuidGraphType>))
new QueryArgument(AllTypes.None)
{
Name = "id",
Description = $"The id of the {schemaName} content (GUID)",
DefaultValue = string.Empty
DefaultValue = string.Empty,
ResolvedType = AllTypes.NonNullGuid
}
};
}
@ -169,23 +171,26 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
{
return new QueryArguments
{
new QueryArgument(typeof(IntGraphType))
new QueryArgument(AllTypes.None)
{
Name = "take",
Description = "Optional number of assets to take (Default: 20).",
DefaultValue = 20
DefaultValue = 20,
ResolvedType = AllTypes.Int
},
new QueryArgument(typeof(IntGraphType))
new QueryArgument(AllTypes.None)
{
Name = "skip",
Description = "Optional number of assets to skip.",
DefaultValue = 0
DefaultValue = 0,
ResolvedType = AllTypes.Int
},
new QueryArgument(typeof(StringGraphType))
new QueryArgument(AllTypes.None)
{
Name = "search",
Description = "Optional query to limit the files by name.",
DefaultValue = string.Empty
DefaultValue = string.Empty,
ResolvedType = AllTypes.String
}
};
}
@ -194,35 +199,40 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
{
return new QueryArguments
{
new QueryArgument(typeof(IntGraphType))
new QueryArgument(AllTypes.None)
{
Name = "top",
Description = "Optional number of contents to take (Default: 20).",
DefaultValue = 20
DefaultValue = 20,
ResolvedType = AllTypes.Int
},
new QueryArgument(typeof(IntGraphType))
new QueryArgument(AllTypes.None)
{
Name = "skip",
Description = "Optional number of contents to skip.",
DefaultValue = 0
DefaultValue = 0,
ResolvedType = AllTypes.Int
},
new QueryArgument(typeof(StringGraphType))
new QueryArgument(AllTypes.None)
{
Name = "filter",
Description = "Optional OData filter.",
DefaultValue = string.Empty
DefaultValue = string.Empty,
ResolvedType = AllTypes.String
},
new QueryArgument(typeof(StringGraphType))
new QueryArgument(AllTypes.None)
{
Name = "search",
Description = "Optional OData full text search.",
DefaultValue = string.Empty
DefaultValue = string.Empty,
ResolvedType = AllTypes.String
},
new QueryArgument(typeof(StringGraphType))
new QueryArgument(AllTypes.None)
{
Name = "orderby",
Description = "Optional OData order definition.",
DefaultValue = string.Empty
DefaultValue = string.Empty,
ResolvedType = AllTypes.String
}
};
}

34
src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/AssetGraphType.cs

@ -22,7 +22,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
AddField(new FieldType
{
Name = "id",
ResolvedType = new NonNullGraphType(new StringGraphType()),
ResolvedType = AllTypes.NonNullGuid,
Resolver = Resolve(x => x.Id.ToString()),
Description = "The id of the asset."
});
@ -30,7 +30,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
AddField(new FieldType
{
Name = "version",
ResolvedType = new NonNullGraphType(new IntGraphType()),
ResolvedType = AllTypes.NonNullInt,
Resolver = Resolve(x => x.Version),
Description = "The version of the asset."
});
@ -38,7 +38,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
AddField(new FieldType
{
Name = "created",
ResolvedType = new NonNullGraphType(new DateGraphType()),
ResolvedType = AllTypes.NonNullDate,
Resolver = Resolve(x => x.Created.ToDateTimeUtc()),
Description = "The date and time when the asset has been created."
});
@ -46,7 +46,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
AddField(new FieldType
{
Name = "createdBy",
ResolvedType = new NonNullGraphType(new StringGraphType()),
ResolvedType = AllTypes.NonNullString,
Resolver = Resolve(x => x.CreatedBy.ToString()),
Description = "The user that has created the asset."
});
@ -54,7 +54,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
AddField(new FieldType
{
Name = "lastModified",
ResolvedType = new NonNullGraphType(new DateGraphType()),
ResolvedType = AllTypes.NonNullDate,
Resolver = Resolve(x => x.LastModified.ToDateTimeUtc()),
Description = "The date and time when the asset has been modified last."
});
@ -62,7 +62,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
AddField(new FieldType
{
Name = "lastModifiedBy",
ResolvedType = new NonNullGraphType(new StringGraphType()),
ResolvedType = AllTypes.NonNullString,
Resolver = Resolve(x => x.LastModifiedBy.ToString()),
Description = "The user that has updated the asset last."
});
@ -70,7 +70,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
AddField(new FieldType
{
Name = "mimeType",
ResolvedType = new NonNullGraphType(new StringGraphType()),
ResolvedType = AllTypes.NonNullString,
Resolver = Resolve(x => x.MimeType),
Description = "The mime type."
});
@ -78,7 +78,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
AddField(new FieldType
{
Name = "url",
ResolvedType = new NonNullGraphType(new StringGraphType()),
ResolvedType = AllTypes.NonNullString,
Resolver = model.ResolveAssetUrl(),
Description = "The url to the asset."
});
@ -86,7 +86,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
AddField(new FieldType
{
Name = "thumbnailUrl",
ResolvedType = new StringGraphType(),
ResolvedType = AllTypes.String,
Resolver = model.ResolveAssetThumbnailUrl(),
Description = "The thumbnail url to the asset."
});
@ -94,7 +94,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
AddField(new FieldType
{
Name = "fileName",
ResolvedType = new NonNullGraphType(new StringGraphType()),
ResolvedType = AllTypes.NonNullString,
Resolver = Resolve(x => x.FileName),
Description = "The file name."
});
@ -102,7 +102,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
AddField(new FieldType
{
Name = "fileType",
ResolvedType = new NonNullGraphType(new StringGraphType()),
ResolvedType = AllTypes.NonNullString,
Resolver = Resolve(x => x.FileName.FileType()),
Description = "The file type."
});
@ -110,7 +110,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
AddField(new FieldType
{
Name = "fileSize",
ResolvedType = new NonNullGraphType(new IntGraphType()),
ResolvedType = AllTypes.NonNullInt,
Resolver = Resolve(x => x.FileSize),
Description = "The size of the file in bytes."
});
@ -118,7 +118,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
AddField(new FieldType
{
Name = "fileVersion",
ResolvedType = new NonNullGraphType(new IntGraphType()),
ResolvedType = AllTypes.NonNullInt,
Resolver = Resolve(x => x.FileVersion),
Description = "The version of the file."
});
@ -126,7 +126,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
AddField(new FieldType
{
Name = "isImage",
ResolvedType = new NonNullGraphType(new BooleanGraphType()),
ResolvedType = AllTypes.NonNullBoolean,
Resolver = Resolve(x => x.IsImage),
Description = "Determines of the created file is an image."
});
@ -134,7 +134,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
AddField(new FieldType
{
Name = "pixelWidth",
ResolvedType = new IntGraphType(),
ResolvedType = AllTypes.Int,
Resolver = Resolve(x => x.PixelWidth),
Description = "The width of the image in pixels if the asset is an image."
});
@ -142,7 +142,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
AddField(new FieldType
{
Name = "pixelHeight",
ResolvedType = new IntGraphType(),
ResolvedType = AllTypes.Int,
Resolver = Resolve(x => x.PixelHeight),
Description = "The height of the image in pixels if the asset is an image."
});
@ -152,7 +152,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
AddField(new FieldType
{
Name = "sourceUrl",
ResolvedType = new StringGraphType(),
ResolvedType = AllTypes.NonNullString,
Resolver = model.ResolveAssetSourceUrl(),
Description = "The source url of the asset."
});

2
src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/AssetsResultGraphType.cs

@ -22,8 +22,8 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
AddField(new FieldType
{
Name = "total",
ResolvedType = AllTypes.Int,
Resolver = Resolve(x => x.Total),
ResolvedType = new NonNullGraphType(new IntGraphType()),
Description = $"The total count of assets."
});

2
src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/CommandVersionGraphType.cs

@ -20,7 +20,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
AddField(new FieldType
{
Name = "version",
ResolvedType = new IntGraphType(),
ResolvedType = AllTypes.Int,
Resolver = ResolveVersion(),
Description = "The new version of the item."
});

2
src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/ContentDataChangedResultGraphType.cs

@ -20,7 +20,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
AddField(new FieldType
{
Name = "version",
ResolvedType = new IntGraphType(),
ResolvedType = AllTypes.Int,
Resolver = Resolve(x => x.Version),
Description = $"The new version of the {schemaName} content."
});

3
src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/ContentDataGraphInputType.cs

@ -62,7 +62,8 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
{
Name = field.Name.ToCamelCase(),
Resolver = fieldResolver,
ResolvedType = fieldGraphType
ResolvedType = fieldGraphType,
Description = $"The {fieldName} field."
});
}
}

3
src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/ContentDataGraphType.cs

@ -57,7 +57,8 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
{
Name = field.Name.ToCamelCase(),
Resolver = fieldResolver,
ResolvedType = fieldGraphType
ResolvedType = fieldGraphType,
Description = $"The {fieldName} field."
});
}
}

16
src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/ContentGraphType.cs

@ -25,15 +25,15 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
AddField(new FieldType
{
Name = "id",
ResolvedType = new NonNullGraphType(new StringGraphType()),
Resolver = Resolve(x => x.Id.ToString()),
ResolvedType = AllTypes.NonNullGuid,
Resolver = Resolve(x => x.Id),
Description = $"The id of the {schemaName} content."
});
AddField(new FieldType
{
Name = "version",
ResolvedType = new NonNullGraphType(new IntGraphType()),
ResolvedType = AllTypes.NonNullInt,
Resolver = Resolve(x => x.Version),
Description = $"The version of the {schemaName} content."
});
@ -41,7 +41,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
AddField(new FieldType
{
Name = "created",
ResolvedType = new NonNullGraphType(new DateGraphType()),
ResolvedType = AllTypes.NonNullDate,
Resolver = Resolve(x => x.Created.ToDateTimeUtc()),
Description = $"The date and time when the {schemaName} content has been created."
});
@ -49,7 +49,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
AddField(new FieldType
{
Name = "createdBy",
ResolvedType = new NonNullGraphType(new StringGraphType()),
ResolvedType = AllTypes.NonNullString,
Resolver = Resolve(x => x.CreatedBy.ToString()),
Description = $"The user that has created the {schemaName} content."
});
@ -57,7 +57,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
AddField(new FieldType
{
Name = "lastModified",
ResolvedType = new NonNullGraphType(new DateGraphType()),
ResolvedType = AllTypes.NonNullDate,
Resolver = Resolve(x => x.LastModified.ToDateTimeUtc()),
Description = $"The date and time when the {schemaName} content has been modified last."
});
@ -65,7 +65,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
AddField(new FieldType
{
Name = "lastModifiedBy",
ResolvedType = new NonNullGraphType(new StringGraphType()),
ResolvedType = AllTypes.NonNullString,
Resolver = Resolve(x => x.LastModifiedBy.ToString()),
Description = $"The user that has updated the {schemaName} content last."
});
@ -73,7 +73,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
AddField(new FieldType
{
Name = "url",
ResolvedType = new NonNullGraphType(new StringGraphType()),
ResolvedType = AllTypes.NonNullString,
Resolver = model.ResolveContentUrl(schema),
Description = $"The url to the the {schemaName} content."
});

2
src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/ContentsResultGraphType.cs

@ -22,7 +22,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
{
Name = "total",
Resolver = Resolver(x => x.Total),
ResolvedType = new NonNullGraphType(new IntGraphType()),
ResolvedType = AllTypes.NonNullInt,
Description = $"The total number of {schemaName} items."
});

4
src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/GeolocationInputGraphType.cs

@ -18,13 +18,13 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
AddField(new FieldType
{
Name = "latitude",
ResolvedType = new NonNullGraphType(new FloatGraphType())
ResolvedType = AllTypes.NonNullFloat
});
AddField(new FieldType
{
Name = "longitude",
ResolvedType = new NonNullGraphType(new FloatGraphType())
ResolvedType = AllTypes.NonNullFloat
});
}
}

Loading…
Cancel
Save