< Summary

Information
Class: Elsa.Workflows.Api.Endpoints.WorkflowDefinitions.BulkDeleteVersions.BulkDeleteVersions
Assembly: Elsa.Workflows.Api
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Api/Endpoints/WorkflowDefinitions/BulkDeleteVersions/Endpoint.cs
Line coverage
36%
Covered lines: 4
Uncovered lines: 7
Coverable lines: 11
Total lines: 33
Line coverage: 36.3%
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%11100%
Configure()100%11100%
ExecuteAsync()0%620%

File(s)

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

#LineLine coverage
 1using Elsa.Abstractions;
 2using Elsa.Workflows.Api.Constants;
 3using Elsa.Workflows.Api.Requirements;
 4using Elsa.Workflows.Management;
 5using JetBrains.Annotations;
 6using Microsoft.AspNetCore.Authorization;
 7
 8namespace Elsa.Workflows.Api.Endpoints.WorkflowDefinitions.BulkDeleteVersions;
 9
 10[PublicAPI]
 111internal class BulkDeleteVersions(IWorkflowDefinitionManager workflowDefinitionManager, IAuthorizationService authorizat
 12    : ElsaEndpoint<Request, Response>
 13{
 14    public override void Configure()
 15    {
 116        Post("/bulk-actions/delete/workflow-definitions/by-id");
 117        ConfigurePermissions("delete:workflow-definitions");
 118    }
 19
 20    public override async Task<Response> ExecuteAsync(Request request, CancellationToken cancellationToken)
 21    {
 022        var authorizationResult = await authorizationService.AuthorizeAsync(User, new NotReadOnlyResource(), Authorizati
 23
 024        if (!authorizationResult.Succeeded)
 25        {
 026            await Send.ForbiddenAsync(cancellationToken);
 027            return null!;
 28        }
 29
 030        var count = await workflowDefinitionManager.BulkDeleteByIdsAsync(request.Ids, cancellationToken);
 031        return new Response(count);
 032    }
 33}