| | | 1 | | using Elsa.Abstractions; |
| | | 2 | | using Elsa.Common.Models; |
| | | 3 | | using Elsa.Models; |
| | | 4 | | using Elsa.Resilience.Entities; |
| | | 5 | | |
| | | 6 | | namespace Elsa.Resilience.Endpoints.Retries.List; |
| | | 7 | | |
| | 1 | 8 | | public class Endpoint(IRetryAttemptReader reader) : ElsaEndpointWithoutRequest |
| | | 9 | | { |
| | | 10 | | public override void Configure() |
| | | 11 | | { |
| | 1 | 12 | | Get("/resilience/retries/{activityInstanceId}"); |
| | 1 | 13 | | ConfigurePermissions("read:*", "read:resilience", "read:resilience:retries"); |
| | 1 | 14 | | } |
| | | 15 | | |
| | | 16 | | public override async Task HandleAsync(CancellationToken ct) |
| | | 17 | | { |
| | 0 | 18 | | var skip = Query<int?>("skip", false); |
| | 0 | 19 | | var take = Query<int?>("take", false); |
| | 0 | 20 | | var pageArgs = skip == null && take == null ? null : PageArgs.FromRange(skip, take); |
| | 0 | 21 | | var activityInstanceId = Route<string>("activityInstanceId"); |
| | | 22 | | |
| | 0 | 23 | | if (string.IsNullOrWhiteSpace(activityInstanceId)) |
| | | 24 | | { |
| | 0 | 25 | | AddError("ActivityInstanceId is required."); |
| | 0 | 26 | | await Send.ErrorsAsync(cancellation: ct); |
| | 0 | 27 | | return; |
| | | 28 | | } |
| | | 29 | | |
| | 0 | 30 | | var page = await reader.ReadAttemptsAsync(activityInstanceId, pageArgs, ct); |
| | 0 | 31 | | var response = new PagedListResponse<RetryAttemptRecord>(page); |
| | 0 | 32 | | await Send.OkAsync(response, ct); |
| | 0 | 33 | | } |
| | | 34 | | } |