< Summary

Information
Class: Elsa.Labels.Endpoints.Labels.Delete.Delete
Assembly: Elsa.Labels
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Labels/Endpoints/Labels/Delete/Endpoint.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 9
Coverable lines: 9
Total lines: 27
Line coverage: 0%
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%210%
Configure()100%210%
HandleAsync()0%620%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Labels/Endpoints/Labels/Delete/Endpoint.cs

#LineLine coverage
 1using Elsa.Labels.Contracts;
 2using FastEndpoints;
 3
 4namespace Elsa.Labels.Endpoints.Labels.Delete;
 5
 6public class Delete : Endpoint<Request>
 7{
 8    private readonly ILabelStore _store;
 9
 010    public Delete(ILabelStore store) => _store = store;
 11
 12    public override void Configure()
 13    {
 014        Delete("/labels/{id}");
 015        Policies(Constants.PolicyName);
 016    }
 17
 18    public override async Task HandleAsync(Request request, CancellationToken cancellationToken)
 19    {
 020        var deleted = await _store.DeleteAsync(request.Id, cancellationToken);
 21
 022        if (deleted)
 023            await Send.NoContentAsync(cancellationToken);
 24        else
 025            await Send.NotFoundAsync(cancellationToken);
 026    }
 27}