< Summary

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

#LineLine coverage
 1using Elsa.Abstractions;
 2using Elsa.Workflows.Management;
 3using JetBrains.Annotations;
 4
 5namespace Elsa.Workflows.Api.Endpoints.WorkflowDefinitions.IsNameUnique;
 6
 7/// <summary>
 8/// Checks if a workflow definition name is unique.
 9/// </summary>
 10[PublicAPI]
 111internal class IsNameUnique(IWorkflowDefinitionStore store) : ElsaEndpoint<Request>
 12{
 13    public override void Configure()
 14    {
 115        Get("/workflow-definitions/validation/is-name-unique");
 116        ConfigurePermissions("read:workflow-definitions");
 117    }
 18
 19    public override async Task HandleAsync(Request request, CancellationToken cancellationToken)
 20    {
 021        var isUnique = await store.GetIsNameUnique(request.Name.Trim(), request.DefinitionId, cancellationToken);
 022        var response = new Response(isUnique);
 23
 024        await Send.OkAsync(response, cancellationToken);
 025    }
 26}