| | | 1 | | using Elsa.Abstractions; |
| | | 2 | | using Elsa.Common.Entities; |
| | | 3 | | using Elsa.Models; |
| | | 4 | | using Elsa.Workflows.Runtime; |
| | | 5 | | using Elsa.Workflows.Runtime.Entities; |
| | | 6 | | using Elsa.Workflows.Runtime.Filters; |
| | | 7 | | using Elsa.Workflows.Runtime.OrderDefinitions; |
| | | 8 | | using JetBrains.Annotations; |
| | | 9 | | |
| | | 10 | | namespace Elsa.Workflows.Api.Endpoints.ActivityExecutionSummaries.ListSummaries; |
| | | 11 | | |
| | | 12 | | /// <summary> |
| | | 13 | | /// Lists a summary view of the executions for a given activity. |
| | | 14 | | /// </summary> |
| | | 15 | | [PublicAPI] |
| | 1 | 16 | | internal class Endpoint(IActivityExecutionStore store) : ElsaEndpoint<Request, ListResponse<ActivityExecutionRecordSumma |
| | | 17 | | { |
| | | 18 | | /// <inheritdoc /> |
| | | 19 | | public override void Configure() |
| | | 20 | | { |
| | 1 | 21 | | Get("/activity-execution-summaries/list"); |
| | 1 | 22 | | ConfigurePermissions("read:activity-execution"); |
| | 1 | 23 | | } |
| | | 24 | | |
| | | 25 | | /// <inheritdoc /> |
| | | 26 | | public override async Task<ListResponse<ActivityExecutionRecordSummary>> ExecuteAsync(Request request, CancellationT |
| | | 27 | | { |
| | 0 | 28 | | var filter = new ActivityExecutionRecordFilter |
| | 0 | 29 | | { |
| | 0 | 30 | | WorkflowInstanceId = request.WorkflowInstanceId, |
| | 0 | 31 | | ActivityNodeId = request.ActivityNodeId, |
| | 0 | 32 | | Completed = request.Completed |
| | 0 | 33 | | }; |
| | 0 | 34 | | var order = new ActivityExecutionRecordOrder<DateTimeOffset>(x => x.StartedAt, OrderDirection.Ascending); |
| | 0 | 35 | | var records = (await store.FindManySummariesAsync(filter, order, cancellationToken)).ToList(); |
| | 0 | 36 | | return new ListResponse<ActivityExecutionRecordSummary>(records); |
| | 0 | 37 | | } |
| | | 38 | | } |