< Summary

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

#LineLine coverage
 1using Elsa.Abstractions;
 2using Elsa.Workflows.Api.Models;
 3using Elsa.Workflows.Management;
 4using Elsa.Workflows.Management.Filters;
 5using JetBrains.Annotations;
 6
 7namespace Elsa.Workflows.Api.Endpoints.WorkflowInstances.Get;
 8
 9[PublicAPI]
 110internal class Get(IWorkflowInstanceStore store) : ElsaEndpoint<Request, WorkflowInstanceModel, WorkflowInstanceMapper>
 11{
 12    public override void Configure()
 13    {
 114        Get("/workflow-instances/{id}");
 115        ConfigurePermissions("read:workflow-instances");
 116    }
 17
 18    public override async Task HandleAsync(Request request, CancellationToken cancellationToken)
 19    {
 020        var filter = new WorkflowInstanceFilter { Id = request.Id };
 021        var workflowInstance = await store.FindAsync(filter, cancellationToken);
 22
 023        if (workflowInstance == null)
 024            await Send.NotFoundAsync(cancellationToken);
 25        else
 026            await Send.OkAsync(Map.FromEntity(workflowInstance), cancellationToken);
 027    }
 28}