| | | 1 | | using Elsa.Abstractions; |
| | | 2 | | using Elsa.Workflows.Api.Endpoints.BookmarkQueueDeadLetters; |
| | | 3 | | using Elsa.Workflows.Runtime; |
| | | 4 | | using Elsa.Workflows.Runtime.Filters; |
| | | 5 | | using JetBrains.Annotations; |
| | | 6 | | using Microsoft.AspNetCore.Http; |
| | | 7 | | |
| | | 8 | | namespace Elsa.Workflows.Api.Endpoints.BookmarkQueueDeadLetters.Get; |
| | | 9 | | |
| | | 10 | | [UsedImplicitly] |
| | 3 | 11 | | internal class Endpoint(IBookmarkQueueDeadLetterStore store) : ElsaEndpointWithoutRequest<BookmarkQueueDeadLetterModel> |
| | | 12 | | { |
| | | 13 | | public override void Configure() |
| | | 14 | | { |
| | 3 | 15 | | Get("/bookmark-queue/dead-letters/{id}"); |
| | 3 | 16 | | ConfigurePermissions(PermissionNames.ReadBookmarkQueueDeadLetters); |
| | 3 | 17 | | } |
| | | 18 | | |
| | | 19 | | public override async Task HandleAsync(CancellationToken cancellationToken) |
| | | 20 | | { |
| | 0 | 21 | | var id = Route<string>("id")!; |
| | 0 | 22 | | var item = await store.FindAsync(new BookmarkQueueDeadLetterFilter { Id = id }, cancellationToken); |
| | | 23 | | |
| | 0 | 24 | | if (item == null) |
| | | 25 | | { |
| | 0 | 26 | | await Send.NotFoundAsync(cancellationToken); |
| | 0 | 27 | | return; |
| | | 28 | | } |
| | | 29 | | |
| | 0 | 30 | | await Send.OkAsync(BookmarkQueueDeadLetterModel.FromEntity(item), cancellationToken); |
| | 0 | 31 | | } |
| | | 32 | | } |