< Summary

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

File(s)

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

#LineLine coverage
 1using Elsa.Extensions;
 2using Elsa.Features.Abstractions;
 3using Elsa.Features.Attributes;
 4using Elsa.Features.Services;
 5using Elsa.SasTokens.Features;
 6using Elsa.Workflows.Api.Constants;
 7using Elsa.Workflows.Api.Requirements;
 8using Elsa.Workflows.Api.Serialization;
 9using Elsa.Workflows.Api.Services;
 10using Elsa.Workflows.Management.Features;
 11using Elsa.Workflows.Runtime.Features;
 12using Microsoft.AspNetCore.Authorization;
 13using Microsoft.Extensions.DependencyInjection;
 14
 15namespace Elsa.Workflows.Api.Features;
 16
 17/// <summary>
 18/// Adds workflows API features.
 19/// </summary>
 20[DependsOn(typeof(WorkflowInstancesFeature))]
 21[DependsOn(typeof(WorkflowManagementFeature))]
 22[DependsOn(typeof(WorkflowRuntimeFeature))]
 23[DependsOn(typeof(SasTokensFeature))]
 124public class WorkflowsApiFeature(IModule module) : FeatureBase(module)
 25{
 26    /// <inheritdoc />
 27    public override void Configure()
 28    {
 129        Module.AddFastEndpointsAssembly(GetType());
 130    }
 31
 32    /// <inheritdoc />
 33    public override void Apply()
 34    {
 135        Services.AddSerializationOptionsConfigurator<SerializationConfigurator>();
 136        Module.AddFastEndpointsFromModule();
 37
 138        Services.AddScoped<IWorkflowDefinitionLinker, StaticWorkflowDefinitionLinker>();
 139        Services.AddScoped<IAuthorizationHandler, NotReadOnlyRequirementHandler>();
 140        Services.Configure<AuthorizationOptions>(options =>
 141        {
 242            options.AddPolicy(AuthorizationPolicies.NotReadOnlyPolicy, policy => policy.AddRequirements(new NotReadOnlyR
 243        });
 144    }
 45}