< Summary

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

File(s)

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

#LineLine coverage
 1using Elsa.Abstractions;
 2using Elsa.Workflows.Runtime;
 3using Elsa.Workflows.Runtime.Requests;
 4using Elsa.Workflows.Runtime.Responses;
 5using JetBrains.Annotations;
 6
 7namespace Elsa.Workflows.Api.Endpoints.WorkflowDefinitions.Refresh;
 8
 9[PublicAPI]
 110internal class Refresh(IWorkflowDefinitionsRefresher workflowDefinitionsRefresher) : ElsaEndpoint<Request>
 11{
 12    private const int BatchSize = 10;
 13
 14    public override void Configure()
 15    {
 116        Post("/actions/workflow-definitions/refresh");
 117        ConfigurePermissions("actions:workflow-definitions:refresh");
 118    }
 19
 20    public override async Task HandleAsync(Request request, CancellationToken cancellationToken)
 21    {
 022        var result = await RefreshWorkflowDefinitionsAsync(request.DefinitionIds, cancellationToken);
 023        await Send.OkAsync(new Response(result.Refreshed, result.NotFound), cancellationToken);
 024    }
 25
 26    private async Task<RefreshWorkflowDefinitionsResponse> RefreshWorkflowDefinitionsAsync(ICollection<string>? definiti
 27    {
 028        var request = new RefreshWorkflowDefinitionsRequest(definitionIds, BatchSize);
 029        return await workflowDefinitionsRefresher.RefreshWorkflowDefinitionsAsync(request, cancellationToken);
 030    }
 31}