< Summary

Information
Class: Elsa.Workflows.Api.Endpoints.RuntimeAdmin.Pause.PauseEndpoint
Assembly: Elsa.Workflows.Api
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Api/Endpoints/RuntimeAdmin/Pause/Endpoint.cs
Line coverage
57%
Covered lines: 4
Uncovered lines: 3
Coverable lines: 7
Total lines: 26
Line coverage: 57.1%
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%
HandleAsync()0%620%

File(s)

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

#LineLine coverage
 1using Elsa.Abstractions;
 2using Elsa.Workflows.Runtime;
 3using FastEndpoints;
 4using JetBrains.Annotations;
 5
 6namespace Elsa.Workflows.Api.Endpoints.RuntimeAdmin.Pause;
 7
 8/// <summary>
 9/// <c>POST /admin/workflow-runtime/pause</c> — places the runtime into <see cref="QuiescenceReason.AdministrativePause"
 10/// Idempotent: subsequent calls return the current state without producing additional audit events (SC-007).
 11/// </summary>
 12[PublicAPI]
 313internal sealed class PauseEndpoint(IWorkflowRuntimeAdminService admin) : ElsaEndpoint<PauseRequest, StatusResponse>
 14{
 15    public override void Configure()
 16    {
 317        Post("/admin/workflow-runtime/pause");
 318        ConfigurePermissions(PermissionNames.ManageWorkflowRuntime);
 319    }
 20
 21    public override async Task HandleAsync(PauseRequest req, CancellationToken ct)
 22    {
 023        await admin.PauseAsync(req.Reason, HttpContext.User.Identity?.Name, ct);
 024        await Send.OkAsync(StatusResponseFactory.Build(admin.GetStatus()), ct);
 025    }
 26}