diff --git a/src/common/Elsa.Api.Common/Extensions/WebApplicationExtensions.cs b/src/common/Elsa.Api.Common/Extensions/WebApplicationExtensions.cs index aaf4722ce..56bfbf28c 100644 --- a/src/common/Elsa.Api.Common/Extensions/WebApplicationExtensions.cs +++ b/src/common/Elsa.Api.Common/Extensions/WebApplicationExtensions.cs @@ -1,3 +1,4 @@ +using System.Globalization; using System.Text.Json; using System.Text.Json.Serialization; using Elsa.Workflows.Contracts; @@ -29,6 +30,9 @@ public static class WebApplicationExtensions config.Endpoints.RoutePrefix = routePrefix; config.Serializer.RequestDeserializer = DeserializeRequestAsync; config.Serializer.ResponseSerializer = SerializeRequestAsync; + + config.Binding.ValueParserFor(s => + new(DateTime.TryParse(s.ToString(),CultureInfo.InvariantCulture,DateTimeStyles.RoundtripKind, out var result), result)); }); /// diff --git a/src/modules/Elsa.Workflows.Api/Endpoints/WorkflowInstances/Journal/HasUpdates/Endpoint.cs b/src/modules/Elsa.Workflows.Api/Endpoints/WorkflowInstances/Journal/HasUpdates/Endpoint.cs index 4bf03ae89..a535e25c9 100644 --- a/src/modules/Elsa.Workflows.Api/Endpoints/WorkflowInstances/Journal/HasUpdates/Endpoint.cs +++ b/src/modules/Elsa.Workflows.Api/Endpoints/WorkflowInstances/Journal/HasUpdates/Endpoint.cs @@ -10,16 +10,8 @@ namespace Elsa.Workflows.Api.Endpoints.WorkflowInstances.Journal.HasUpdates; /// Endpoint that checks if there are updates for a workflow instance. [PublicAPI] -internal class HasUpdates : ElsaEndpoint +internal class HasUpdates(IWorkflowExecutionLogStore store) : ElsaEndpoint { - private readonly IWorkflowExecutionLogStore _store; - - /// - public HasUpdates(IWorkflowExecutionLogStore store) - { - _store = store; - } - /// public override void Configure() { @@ -33,7 +25,7 @@ internal class HasUpdates : ElsaEndpoint var pageArgs = PageArgs.From(1, 1, 0, 1); var filter = new WorkflowExecutionLogRecordFilter { WorkflowInstanceId = request.WorkflowInstanceId }; var order = new WorkflowExecutionLogRecordOrder(x => x.Sequence, OrderDirection.Descending); - var pageOfRecords = await _store.FindManyAsync(filter, pageArgs, order, cancellationToken); + var pageOfRecords = await store.FindManyAsync(filter, pageArgs, order, cancellationToken); return pageOfRecords.Items.Any(item => item.Timestamp >= request.UpdatesSince); }