< Summary

Information
Class: Elsa.Workflows.Api.ShellFeatures.WorkflowsApiFeature
Assembly: Elsa.Workflows.Api
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Api/ShellFeatures/WorkflowsApiFeature.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 9
Coverable lines: 9
Total lines: 46
Line coverage: 0%
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
ConfigureServices(...)100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Api/ShellFeatures/WorkflowsApiFeature.cs

#LineLine coverage
 1using CShells.FastEndpoints.Features;
 2using CShells.Features;
 3using Elsa.Extensions;
 4using Elsa.Workflows.Api.Constants;
 5using Elsa.Workflows.Api.Requirements;
 6using Elsa.Workflows.Api.Serialization;
 7using Elsa.Workflows.Api.Services;
 8using JetBrains.Annotations;
 9using Microsoft.AspNetCore.Authorization;
 10using Microsoft.Extensions.DependencyInjection;
 11
 12namespace Elsa.Workflows.Api.ShellFeatures;
 13
 14/// <summary>
 15/// Adds workflows API features with FastEndpoints support.
 16/// </summary>
 17/// <remarks>
 18/// This feature implements <see cref="IFastEndpointsShellFeature"/> to indicate that this assembly
 19/// contains FastEndpoints that should be automatically discovered and registered.
 20/// </remarks>
 21[ShellFeature(
 22    DisplayName = "Workflows API",
 23    Description = "Provides REST API endpoints for workflow management",
 24    DependsOn =
 25[
 26    "ElsaFastEndpoints",
 27    "WorkflowInstances",
 28    "WorkflowManagement",
 29    "WorkflowRuntime",
 30    "SasTokens"
 31])]
 32[UsedImplicitly]
 33public class WorkflowsApiFeature : IFastEndpointsShellFeature
 34{
 35    public void ConfigureServices(IServiceCollection services)
 36    {
 037        services.AddSerializationOptionsConfigurator<SerializationConfigurator>();
 038        services.AddScoped<IWorkflowDefinitionLinker, StaticWorkflowDefinitionLinker>();
 039        services.AddScoped<IAuthorizationHandler, NotReadOnlyRequirementHandler>();
 040        services.Configure<AuthorizationOptions>(options =>
 041        {
 042            options.AddPolicy(AuthorizationPolicies.NotReadOnlyPolicy, policy => policy.AddRequirements(new NotReadOnlyR
 043        });
 044        services.AddScoped<IWorkflowInstanceExportNameProvider, DefaultWorkflowInstanceExportNameProvider>();
 045    }
 46}