< Summary

Information
Class: Elsa.Workflows.Api.Endpoints.ActivityExecutionSummaries.ListSummaries.Endpoint
Assembly: Elsa.Workflows.Api
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Api/Endpoints/ActivityExecutionSummaries/ListSummaries/Endpoint.cs
Line coverage
28%
Covered lines: 4
Uncovered lines: 10
Coverable lines: 14
Total lines: 38
Line coverage: 28.5%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
Configure()100%11100%
ExecuteAsync()100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Api/Endpoints/ActivityExecutionSummaries/ListSummaries/Endpoint.cs

#LineLine coverage
 1using Elsa.Abstractions;
 2using Elsa.Common.Entities;
 3using Elsa.Models;
 4using Elsa.Workflows.Runtime;
 5using Elsa.Workflows.Runtime.Entities;
 6using Elsa.Workflows.Runtime.Filters;
 7using Elsa.Workflows.Runtime.OrderDefinitions;
 8using JetBrains.Annotations;
 9
 10namespace 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]
 116internal class Endpoint(IActivityExecutionStore store) : ElsaEndpoint<Request, ListResponse<ActivityExecutionRecordSumma
 17{
 18    /// <inheritdoc />
 19    public override void Configure()
 20    {
 121        Get("/activity-execution-summaries/list");
 122        ConfigurePermissions("read:activity-execution");
 123    }
 24
 25    /// <inheritdoc />
 26    public override async Task<ListResponse<ActivityExecutionRecordSummary>> ExecuteAsync(Request request, CancellationT
 27    {
 028        var filter = new ActivityExecutionRecordFilter
 029        {
 030            WorkflowInstanceId = request.WorkflowInstanceId,
 031            ActivityNodeId = request.ActivityNodeId,
 032            Completed = request.Completed
 033        };
 034        var order = new ActivityExecutionRecordOrder<DateTimeOffset>(x => x.StartedAt, OrderDirection.Ascending);
 035        var records = (await store.FindManySummariesAsync(filter, order, cancellationToken)).ToList();
 036        return new ListResponse<ActivityExecutionRecordSummary>(records);
 037    }
 38}