< Summary

Information
Class: Elsa.Workflows.Api.Endpoints.WorkflowDefinitions.GetManyById.GetManyById
Assembly: Elsa.Workflows.Api
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Api/Endpoints/WorkflowDefinitions/GetManyById/Endpoint.cs
Line coverage
30%
Covered lines: 4
Uncovered lines: 9
Coverable lines: 13
Total lines: 31
Line coverage: 30.7%
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%
HandleAsync()100%210%

File(s)

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

#LineLine coverage
 1using Elsa.Abstractions;
 2using Elsa.Models;
 3using Elsa.Workflows.Api.Models;
 4using Elsa.Workflows.Management;
 5using Elsa.Workflows.Management.Filters;
 6using JetBrains.Annotations;
 7
 8namespace Elsa.Workflows.Api.Endpoints.WorkflowDefinitions.GetManyById;
 9
 10[PublicAPI]
 111internal class GetManyById(IWorkflowDefinitionStore store, IWorkflowDefinitionLinker linker) : ElsaEndpoint<Request>
 12{
 13    public override void Configure()
 14    {
 115        Get("/workflow-definitions/many-by-id");
 116        ConfigurePermissions("read:workflow-definitions");
 117    }
 18
 19    public override async Task HandleAsync(Request request, CancellationToken cancellationToken)
 20    {
 021        var filter = new WorkflowDefinitionFilter
 022        {
 023            Ids = request.Ids
 024        };
 25
 026        var definitions = (await store.FindManyAsync(filter, cancellationToken)).ToList();
 027        var models = await linker.MapAsync(definitions, cancellationToken);
 028        var response = new ListResponse<LinkedWorkflowDefinitionModel>(models);
 029        await Send.OkAsync(response, cancellationToken);
 030    }
 31}