|
|
@ -10,6 +10,7 @@ using Newtonsoft.Json.Linq; |
|
|
using Squidex.Domain.Apps.Core.HandleRules; |
|
|
using Squidex.Domain.Apps.Core.HandleRules; |
|
|
using Squidex.Domain.Apps.Core.Rules.EnrichedEvents; |
|
|
using Squidex.Domain.Apps.Core.Rules.EnrichedEvents; |
|
|
using Squidex.Domain.Apps.Core.Scripting; |
|
|
using Squidex.Domain.Apps.Core.Scripting; |
|
|
|
|
|
using Squidex.Infrastructure; |
|
|
|
|
|
|
|
|
#pragma warning disable IDE0059 // Value assigned to symbol is never used
|
|
|
#pragma warning disable IDE0059 // Value assigned to symbol is never used
|
|
|
#pragma warning disable MA0048 // File name must match type name
|
|
|
#pragma warning disable MA0048 // File name must match type name
|
|
|
@ -40,12 +41,19 @@ namespace Squidex.Extensions.Actions.ElasticSearch |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
protected override async Task<(string Description, ElasticSearchJob Data)> CreateJobAsync(EnrichedEvent @event, ElasticSearchAction action) |
|
|
protected override async Task<(string Description, ElasticSearchJob Data)> CreateJobAsync(EnrichedEvent @event, ElasticSearchAction action) |
|
|
{ |
|
|
|
|
|
if (@event is IEnrichedEntityEvent entityEvent) |
|
|
|
|
|
{ |
|
|
{ |
|
|
var delete = @event.ShouldDelete(scriptEngine, action.Delete); |
|
|
var delete = @event.ShouldDelete(scriptEngine, action.Delete); |
|
|
|
|
|
|
|
|
var contentId = entityEvent.Id.ToString(); |
|
|
string contentId; |
|
|
|
|
|
|
|
|
|
|
|
if (@event is IEnrichedEntityEvent enrichedEntityEvent) |
|
|
|
|
|
{ |
|
|
|
|
|
contentId = enrichedEntityEvent.Id.ToString(); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
contentId = DomainId.NewGuid().ToString(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
var ruleDescription = string.Empty; |
|
|
var ruleDescription = string.Empty; |
|
|
var ruleJob = new ElasticSearchJob |
|
|
var ruleJob = new ElasticSearchJob |
|
|
@ -95,9 +103,6 @@ namespace Squidex.Extensions.Actions.ElasticSearch |
|
|
return (ruleDescription, ruleJob); |
|
|
return (ruleDescription, ruleJob); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return ("Ignore", new ElasticSearchJob()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected override async Task<Result> ExecuteJobAsync(ElasticSearchJob job, |
|
|
protected override async Task<Result> ExecuteJobAsync(ElasticSearchJob job, |
|
|
CancellationToken ct = default) |
|
|
CancellationToken ct = default) |
|
|
{ |
|
|
{ |
|
|
|