< Summary

Information
Class: Elsa.Resilience.Endpoints.Retries.List.Endpoint
Assembly: Elsa.Resilience
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Resilience/Endpoints/Retries/List/Endpoint.cs
Line coverage
25%
Covered lines: 4
Uncovered lines: 12
Coverable lines: 16
Total lines: 34
Line coverage: 25%
Branch coverage
0%
Covered branches: 0
Total branches: 6
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%4260%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Resilience/Endpoints/Retries/List/Endpoint.cs

#LineLine coverage
 1using Elsa.Abstractions;
 2using Elsa.Common.Models;
 3using Elsa.Models;
 4using Elsa.Resilience.Entities;
 5
 6namespace Elsa.Resilience.Endpoints.Retries.List;
 7
 18public class Endpoint(IRetryAttemptReader reader) : ElsaEndpointWithoutRequest
 9{
 10    public override void Configure()
 11    {
 112        Get("/resilience/retries/{activityInstanceId}");
 113        ConfigurePermissions("read:*", "read:resilience", "read:resilience:retries");
 114    }
 15
 16    public override async Task HandleAsync(CancellationToken ct)
 17    {
 018        var skip = Query<int?>("skip", false);
 019        var take = Query<int?>("take", false);
 020        var pageArgs = skip == null && take == null ? null : PageArgs.FromRange(skip, take);
 021        var activityInstanceId = Route<string>("activityInstanceId");
 22
 023        if (string.IsNullOrWhiteSpace(activityInstanceId))
 24        {
 025            AddError("ActivityInstanceId is required.");
 026            await Send.ErrorsAsync(cancellation: ct);
 027            return;
 28        }
 29
 030        var page = await reader.ReadAttemptsAsync(activityInstanceId, pageArgs, ct);
 031        var response = new PagedListResponse<RetryAttemptRecord>(page);
 032        await Send.OkAsync(response, ct);
 033    }
 34}