< Summary

Information
Class: Elsa.Workflows.Api.Endpoints.WorkflowDefinitions.Count.Count
Assembly: Elsa.Workflows.Api
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Api/Endpoints/WorkflowDefinitions/Count/Endpoint.cs
Line coverage
50%
Covered lines: 4
Uncovered lines: 4
Coverable lines: 8
Total lines: 25
Line coverage: 50%
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/Count/Endpoint.cs

#LineLine coverage
 1using Elsa.Abstractions;
 2using Elsa.Workflows.Management;
 3using JetBrains.Annotations;
 4
 5namespace Elsa.Workflows.Api.Endpoints.WorkflowDefinitions.Count;
 6
 7/// <summary>
 8/// An endpoint for counting workflow definitions.
 9/// </summary>
 10[PublicAPI]
 111internal class Count(IWorkflowDefinitionStore store) : ElsaEndpointWithoutRequest<Response>
 12{
 13    public override void Configure()
 14    {
 115        Get("/workflow-definitions/query/count");
 116        ConfigurePermissions("read:workflow-definitions");
 117    }
 18
 19    public override async Task HandleAsync(CancellationToken cancellationToken)
 20    {
 021        var count = await store.CountDistinctAsync(cancellationToken);
 022        var response = new Response(count);
 023        await Send.OkAsync(response, cancellationToken);
 024    }
 25}