< Summary

Information
Class: Elsa.Workflows.Api.Endpoints.WorkflowInstances.ExecutionState.ExecutionState
Assembly: Elsa.Workflows.Api
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Api/Endpoints/WorkflowInstances/ExecutionState/Endpoint.cs
Line coverage
28%
Covered lines: 4
Uncovered lines: 10
Coverable lines: 14
Total lines: 39
Line coverage: 28.5%
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/WorkflowInstances/ExecutionState/Endpoint.cs

#LineLine coverage
 1using Elsa.Abstractions;
 2using Elsa.Extensions;
 3using Elsa.Workflows.Management;
 4using JetBrains.Annotations;
 5
 6namespace Elsa.Workflows.Api.Endpoints.WorkflowInstances.ExecutionState;
 7
 8/// <summary>
 9/// Returns the execution state of the specified workflow instance.
 10/// </summary>
 11[PublicAPI]
 112internal class ExecutionState(IWorkflowInstanceStore store) : ElsaEndpoint<Request, Response>
 13{
 14    /// <inheritdoc />
 15    public override void Configure()
 16    {
 117        Get("/workflow-instances/{id}/execution-state");
 118        ConfigurePermissions("read:workflow-instances");
 119    }
 20
 21    /// <inheritdoc />
 22    public override async Task HandleAsync(Request request, CancellationToken cancellationToken)
 23    {
 024        var workflowInstance = await store.FindAsync(request.WorkflowInstanceId, cancellationToken);
 25
 026        if (workflowInstance == null)
 27        {
 028            await Send.NotFoundAsync(cancellationToken);
 029            return;
 30        }
 31
 032        var response = new Response(
 033            workflowInstance.Status,
 034            workflowInstance.SubStatus,
 035            workflowInstance.UpdatedAt);
 36
 037        await Send.OkAsync(response, cancellationToken);
 038    }
 39}