diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/FieldDescriptions.Designer.cs b/backend/src/Squidex.Domain.Apps.Core.Model/FieldDescriptions.Designer.cs
index 5504b9fcc..abb9aa2f3 100644
--- a/backend/src/Squidex.Domain.Apps.Core.Model/FieldDescriptions.Designer.cs
+++ b/backend/src/Squidex.Domain.Apps.Core.Model/FieldDescriptions.Designer.cs
@@ -672,6 +672,15 @@ namespace Squidex.Domain.Apps.Core {
}
}
+ ///
+ /// Looks up a localized string similar to The list of IDs..
+ ///
+ public static string EntityIds {
+ get {
+ return ResourceManager.GetString("EntityIds", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to True when deleted..
///
diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/FieldDescriptions.resx b/backend/src/Squidex.Domain.Apps.Core.Model/FieldDescriptions.resx
index 102999c0b..fb2bdafa3 100644
--- a/backend/src/Squidex.Domain.Apps.Core.Model/FieldDescriptions.resx
+++ b/backend/src/Squidex.Domain.Apps.Core.Model/FieldDescriptions.resx
@@ -321,6 +321,9 @@
The ID of the object (usually GUID).
+
+ The list of IDs.
+
True when deleted.
diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/GraphQLExecutionContext.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/GraphQLExecutionContext.cs
index 76ebc54dc..ae32af775 100644
--- a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/GraphQLExecutionContext.cs
+++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/GraphQLExecutionContext.cs
@@ -154,7 +154,7 @@ public sealed class GraphQLExecutionContext : QueryExecutionContext
return dataLoaders.Context!.GetOrAddBatchLoader(nameof(GetAssetsLoader),
async (batch, ct) =>
{
- var result = await GetReferencedAssetsAsync(new List(batch), ct);
+ var result = await QueryAssetsByIdsAsync(new List(batch), ct);
return result.ToDictionary(x => x.Id);
});
@@ -165,7 +165,7 @@ public sealed class GraphQLExecutionContext : QueryExecutionContext
return dataLoaders.Context!.GetOrAddBatchLoader(nameof(GetContentsLoader),
async (batch, ct) =>
{
- var result = await GetReferencedContentsAsync(new List(batch), ct);
+ var result = await QueryContentsByIdsAsync(new List(batch), ct);
return result.ToDictionary(x => x.Id);
});
diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/ApplicationQueries.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/ApplicationQueries.cs
index 3203cb3f9..6b418d1e4 100644
--- a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/ApplicationQueries.cs
+++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/ApplicationQueries.cs
@@ -17,6 +17,7 @@ internal sealed class ApplicationQueries : ObjectGraphType
AddField(SharedTypes.FindAsset);
AddField(SharedTypes.QueryAssets);
AddField(SharedTypes.QueryAssetsWithTotal);
+ AddContentQuery(builder);
foreach (var schemaInfo in schemaInfos)
{
@@ -73,4 +74,23 @@ internal sealed class ApplicationQueries : ObjectGraphType
Description = $"Query {schemaInfo.DisplayName} content items with total count."
}).WithSchemaId(schemaInfo);
}
+
+ private void AddContentQuery(Builder builder)
+ {
+ var unionType = builder.GetContentUnion("AllContents", null);
+
+ if (!unionType.HasType)
+ {
+ return;
+ }
+
+ AddField(new FieldType
+ {
+ Name = "queryContents",
+ Arguments = ContentActions.QueryByIds.Arguments,
+ ResolvedType = new NonNullGraphType(new ListGraphType(new NonNullGraphType(unionType))),
+ Resolver = ContentActions.QueryByIds.Resolver,
+ Description = "Query content items by IDs across schemeas."
+ });
+ }
}
diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Builder.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Builder.cs
index 217e4a800..4e4f51e18 100644
--- a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Builder.cs
+++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Builder.cs
@@ -22,15 +22,15 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types;
internal sealed class Builder
{
- private readonly Dictionary componentTypes = new Dictionary(ReferenceEqualityComparer.Instance);
- private readonly Dictionary contentTypes = new Dictionary(ReferenceEqualityComparer.Instance);
- private readonly Dictionary contentResultTypes = new Dictionary(ReferenceEqualityComparer.Instance);
- private readonly Dictionary embeddableStringTypes = new Dictionary();
- private readonly Dictionary referenceUnionTypes = new Dictionary();
- private readonly Dictionary componentUnionTypes = new Dictionary();
- private readonly Dictionary nestedTypes = new Dictionary();
- private readonly Dictionary enumTypes = new Dictionary();
- private readonly Dictionary dynamicTypes = new Dictionary();
+ private readonly Dictionary componentUnionTypes = new ();
+ private readonly Dictionary embeddableStringTypes = new ();
+ private readonly Dictionary nestedTypes = new ();
+ private readonly Dictionary componentTypes = new ();
+ private readonly Dictionary contentTypes = new ();
+ private readonly Dictionary contentResultTypes = new ();
+ private readonly Dictionary unionTypes = new ();
+ private readonly Dictionary enumTypes = new ();
+ private readonly Dictionary dynamicTypes = new ();
private readonly FieldVisitor fieldVisitor;
private readonly FieldInputVisitor fieldInputVisitor;
private readonly PartitionResolver partitionResolver;
@@ -186,19 +186,14 @@ internal sealed class Builder
return dynamicTypes.GetOrAdd(graphQLSchema, x => DynamicSchemaBuilder.ParseTypes(x, typeNames));
}
- public EmbeddableStringGraphType GetEmbeddableString(FieldInfo fieldInfo, StringFieldProperties properties)
- {
- return embeddableStringTypes.GetOrAdd(fieldInfo, x => new EmbeddableStringGraphType(this, x, properties));
- }
-
public EnumerationGraphType? GetEnumeration(string name, IEnumerable values)
{
return enumTypes.GetOrAdd(name, x => FieldEnumType.TryCreate(name, values));
}
- public ReferenceUnionGraphType GetReferenceUnion(FieldInfo fieldInfo, ReadonlyList? schemaIds)
+ public EmbeddableStringGraphType GetEmbeddableString(FieldInfo fieldInfo, StringFieldProperties properties)
{
- return referenceUnionTypes.GetOrAdd(fieldInfo, x => new ReferenceUnionGraphType(this, x, schemaIds));
+ return embeddableStringTypes.GetOrAdd(fieldInfo, x => new EmbeddableStringGraphType(this, x, properties));
}
public ComponentUnionGraphType GetComponentUnion(FieldInfo fieldInfo, ReadonlyList? schemaIds)
@@ -206,6 +201,11 @@ internal sealed class Builder
return componentUnionTypes.GetOrAdd(fieldInfo, x => new ComponentUnionGraphType(this, x, schemaIds));
}
+ public ContentUnionGraphType GetContentUnion(string name, ReadonlyList? schemaIds)
+ {
+ return unionTypes.GetOrAdd(name, x => new ContentUnionGraphType(this, x, schemaIds));
+ }
+
public NestedGraphType GetNested(FieldInfo fieldInfo)
{
return nestedTypes.GetOrAdd(fieldInfo, x => new NestedGraphType(this, x));
diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ContentActions.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ContentActions.cs
index b8a034284..04905ade6 100644
--- a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ContentActions.cs
+++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ContentActions.cs
@@ -96,6 +96,26 @@ internal static class ContentActions
});
}
+ public static class QueryByIds
+ {
+ public static readonly QueryArguments Arguments = new QueryArguments
+ {
+ new QueryArgument(Scalars.Strings)
+ {
+ Name = "ids",
+ Description = FieldDescriptions.EntityIds,
+ DefaultValue = null
+ }
+ };
+
+ public static readonly IFieldResolver Resolver = Resolvers.Async