< Summary

Information
Class: Elsa.Workflows.Api.Endpoints.ActivityExecutions.Get.Endpoint
Assembly: Elsa.Workflows.Api
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Api/Endpoints/ActivityExecutions/Get/Endpoint.cs
Line coverage
26%
Covered lines: 4
Uncovered lines: 11
Coverable lines: 15
Total lines: 41
Line coverage: 26.6%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
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%
HandleAsync()0%620%

File(s)

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

#LineLine coverage
 1using Elsa.Abstractions;
 2using Elsa.Workflows.Runtime;
 3using Elsa.Workflows.Runtime.Entities;
 4using Elsa.Workflows.Runtime.Filters;
 5using JetBrains.Annotations;
 6
 7namespace Elsa.Workflows.Api.Endpoints.ActivityExecutions.Get;
 8
 9/// <summary>
 10/// Gets an individual execution for a given activity.
 11/// </summary>
 12[PublicAPI]
 113internal class Endpoint(IActivityExecutionStore store) : ElsaEndpointWithoutRequest<ActivityExecutionRecord>
 14{
 15    /// <inheritdoc />
 16    public override void Configure()
 17    {
 118        Get("/activity-executions/{id}");
 119        ConfigurePermissions("read:activity-execution");
 120    }
 21
 22    /// <inheritdoc />
 23    public override async Task HandleAsync(CancellationToken cancellationToken)
 24    {
 025        var id = Route<string>("id");
 026        var filter = new ActivityExecutionRecordFilter
 027        {
 028            Id = id
 029        };
 30
 031        var record = await store.FindAsync(filter, cancellationToken);
 32
 033        if (record == null)
 34        {
 035            await Send.NotFoundAsync(cancellationToken);
 036            return;
 37        }
 38
 039        await Send.OkAsync(record, cancellationToken);
 040    }
 41}