|
|
@ -61,6 +61,8 @@ namespace Squidex.Domain.Apps.Entities.Contents |
|
|
|
|
|
|
|
|
if (contents.Any()) |
|
|
if (contents.Any()) |
|
|
{ |
|
|
{ |
|
|
|
|
|
var appVersion = context.App.Version.ToString(); |
|
|
|
|
|
|
|
|
var cache = new Dictionary<(Guid, Status), StatusInfo>(); |
|
|
var cache = new Dictionary<(Guid, Status), StatusInfo>(); |
|
|
|
|
|
|
|
|
foreach (var content in contents) |
|
|
foreach (var content in contents) |
|
|
@ -75,14 +77,27 @@ namespace Squidex.Domain.Apps.Entities.Contents |
|
|
await ResolveCanUpdateAsync(content, result); |
|
|
await ResolveCanUpdateAsync(content, result); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
result.CacheDependencies.Add(appVersion); |
|
|
|
|
|
|
|
|
results.Add(result); |
|
|
results.Add(result); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (ShouldEnrichWithReferences(context)) |
|
|
foreach (var group in results.GroupBy(x => x.SchemaId.Id)) |
|
|
{ |
|
|
{ |
|
|
foreach (var group in results.GroupBy(x => x.SchemaId.Id)) |
|
|
var schema = await ContentQuery.GetSchemaOrThrowAsync(context, group.Key.ToString()); |
|
|
|
|
|
|
|
|
|
|
|
var schemaIdentity = schema.Id.ToString(); |
|
|
|
|
|
var schemaVersion = schema.Version.ToString(); |
|
|
|
|
|
|
|
|
|
|
|
foreach (var content in group) |
|
|
|
|
|
{ |
|
|
|
|
|
content.CacheDependencies.Add(schemaIdentity); |
|
|
|
|
|
content.CacheDependencies.Add(schemaVersion); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (ShouldEnrichWithReferences(context)) |
|
|
{ |
|
|
{ |
|
|
await ResolveReferencesAsync(group.Key, group, context); |
|
|
await ResolveReferencesAsync(schema, group, context); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -91,10 +106,8 @@ namespace Squidex.Domain.Apps.Entities.Contents |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private async Task ResolveReferencesAsync(Guid schemaId, IEnumerable<ContentEntity> contents, Context context) |
|
|
private async Task ResolveReferencesAsync(ISchemaEntity schema, IEnumerable<ContentEntity> contents, Context context) |
|
|
{ |
|
|
{ |
|
|
var schema = await ContentQuery.GetSchemaOrThrowAsync(context, schemaId.ToString()); |
|
|
|
|
|
|
|
|
|
|
|
var references = await GetReferencesAsync(schema, contents, context); |
|
|
var references = await GetReferencesAsync(schema, contents, context); |
|
|
|
|
|
|
|
|
var formatted = new Dictionary<IContentEntity, JsonObject>(); |
|
|
var formatted = new Dictionary<IContentEntity, JsonObject>(); |
|
|
@ -116,6 +129,9 @@ namespace Squidex.Domain.Apps.Entities.Contents |
|
|
var referencedSchemaId = field.Properties.SchemaId; |
|
|
var referencedSchemaId = field.Properties.SchemaId; |
|
|
var referencedSchema = await ContentQuery.GetSchemaOrThrowAsync(context, referencedSchemaId.ToString()); |
|
|
var referencedSchema = await ContentQuery.GetSchemaOrThrowAsync(context, referencedSchemaId.ToString()); |
|
|
|
|
|
|
|
|
|
|
|
var schemaIdentity = referencedSchema.Id.ToString(); |
|
|
|
|
|
var schemaVersion = referencedSchema.Version.ToString(); |
|
|
|
|
|
|
|
|
foreach (var content in contents) |
|
|
foreach (var content in contents) |
|
|
{ |
|
|
{ |
|
|
var fieldReference = content.ReferenceData[field.Name]; |
|
|
var fieldReference = content.ReferenceData[field.Name]; |
|
|
@ -146,6 +162,9 @@ namespace Squidex.Domain.Apps.Entities.Contents |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
content.CacheDependencies.Add(schemaIdentity); |
|
|
|
|
|
content.CacheDependencies.Add(schemaVersion); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
catch (DomainObjectNotFoundException) |
|
|
catch (DomainObjectNotFoundException) |
|
|
|