| | | 1 | | using Elsa.Authorization; |
| | | 2 | | using Elsa.Abstractions; |
| | | 3 | | using Elsa.Dashboard.Abstractions.Contracts; |
| | | 4 | | using Elsa.Dashboard.Abstractions.Models; |
| | | 5 | | using Elsa.Dashboard.Api.Permissions; |
| | | 6 | | using JetBrains.Annotations; |
| | | 7 | | |
| | | 8 | | namespace Elsa.Dashboard.Api.Endpoints.Dashboard.Overview; |
| | | 9 | | |
| | | 10 | | [PublicAPI] |
| | 3 | 11 | | internal class Endpoint(IDashboardProvider dashboardProvider) : ElsaEndpointWithoutRequest<DashboardOverview> |
| | | 12 | | { |
| | | 13 | | public override void Configure() |
| | | 14 | | { |
| | 3 | 15 | | Get("/dashboard/overview"); |
| | 3 | 16 | | RequirePermission(Elsa.Dashboard.Api.Permissions.DashboardResourcePermissions.Dashboard, CoreVerbs.View); |
| | 3 | 17 | | } |
| | | 18 | | |
| | | 19 | | public override async Task<DashboardOverview> ExecuteAsync(CancellationToken cancellationToken) |
| | | 20 | | { |
| | 0 | 21 | | var range = Query<string?>("range", false); |
| | 0 | 22 | | var includeSystem = Query<bool>("includeSystem", false); |
| | 0 | 23 | | return await dashboardProvider.GetOverviewAsync(new(range, includeSystem), cancellationToken); |
| | 0 | 24 | | } |
| | | 25 | | } |