From 8a7ccfcd0263ff9ad60f5759a692393431063cab Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Sat, 27 Jan 2018 19:25:04 +0100 Subject: [PATCH] Ensure that we have all properties. --- .../HandleRules/Actions/AlgoliaActionHandler.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Squidex.Domain.Apps.Core.Operations/HandleRules/Actions/AlgoliaActionHandler.cs b/src/Squidex.Domain.Apps.Core.Operations/HandleRules/Actions/AlgoliaActionHandler.cs index 0fdb5003c..345818741 100644 --- a/src/Squidex.Domain.Apps.Core.Operations/HandleRules/Actions/AlgoliaActionHandler.cs +++ b/src/Squidex.Domain.Apps.Core.Operations/HandleRules/Actions/AlgoliaActionHandler.cs @@ -47,12 +47,19 @@ namespace Squidex.Domain.Apps.Core.HandleRules.Actions ruleData["ContentId"] = contentEvent.ContentId.ToString(); ruleData["Operation"] = "Upsert"; + var timestamp = @event.Headers.Timestamp().ToString(); + switch (@event.Payload) { case ContentCreated created: { ruleDescription = $"Add entry to Algolia index: {action.IndexName}"; ruleData["Content"] = new JObject( + new JProperty("id", contentEvent.ContentId), + new JProperty("created", timestamp), + new JProperty("createdBy", created.Actor.ToString()), + new JProperty("lastModified", timestamp), + new JProperty("lastModifiedBy", created.Actor.ToString()), new JProperty("data", JObject.FromObject(created.Data, serializer))); break; } @@ -61,6 +68,8 @@ namespace Squidex.Domain.Apps.Core.HandleRules.Actions { ruleDescription = $"Update entry in Algolia index: {action.IndexName}"; ruleData["Content"] = new JObject( + new JProperty("lastModified", timestamp), + new JProperty("lastModifiedBy", updated.Actor.ToString()), new JProperty("data", JObject.FromObject(updated.Data, serializer))); break; }