| | | 1 | | using Microsoft.AspNetCore.Mvc; |
| | | 2 | | using pva.SuperV.Model.HistoryRetrieval; |
| | | 3 | | using pva.SuperV.Model.Services; |
| | | 4 | | using System.ComponentModel; |
| | | 5 | | |
| | | 6 | | namespace pva.SuperV.Api.Routes.HistoryValues |
| | | 7 | | { |
| | | 8 | | public static class HistoryValuesEndpoints |
| | | 9 | | { |
| | | 10 | | public static WebApplication MapHistoryValuesEndpoints(this WebApplication app) |
| | 131 | 11 | | { |
| | 131 | 12 | | RouteGroupBuilder historyValuesApi = app.MapGroup("/history"); |
| | 131 | 13 | | historyValuesApi.MapPost("/{projectId}/{instanceName}/values/raw", |
| | 131 | 14 | | (IHistoryValuesService historyValuesService, |
| | 131 | 15 | | [Description("ID of project")] string projectId, |
| | 131 | 16 | | [Description("Name of instance")] string instanceName, |
| | 131 | 17 | | [Description("History request")][FromBody] HistoryRequestModel request) |
| | 4 | 18 | | => GetHistoryRawValues.Handle(historyValuesService, projectId, instanceName, request)) |
| | 131 | 19 | | .WithName("GetInstanceRawValuesHistory") |
| | 131 | 20 | | .WithDisplayName("GetInstanceRawValuesHistory") |
| | 131 | 21 | | .WithSummary("Gets history raw values of instance fields between 2 dates.") |
| | 131 | 22 | | .WithDescription("Gets history raw values of instance fields between 2 dates.") |
| | 131 | 23 | | .Produces<HistoryRawResultModel>(StatusCodes.Status200OK) |
| | 131 | 24 | | .Produces<string>(StatusCodes.Status404NotFound) |
| | 131 | 25 | | .Produces<string>(StatusCodes.Status400BadRequest); |
| | 131 | 26 | | historyValuesApi.MapPost("/{projectId}/{instanceName}/values", |
| | 131 | 27 | | (IHistoryValuesService historyValuesService, |
| | 131 | 28 | | [Description("ID of project")] string projectId, |
| | 131 | 29 | | [Description("Name of instance")] string instanceName, |
| | 131 | 30 | | [Description("History request")][FromBody] HistoryRequestModel request) |
| | 4 | 31 | | => GetHistoryValues.Handle(historyValuesService, projectId, instanceName, request)) |
| | 131 | 32 | | .WithName("GetInstanceValuesHistory") |
| | 131 | 33 | | .WithDisplayName("GetInstanceValuesHistory") |
| | 131 | 34 | | .WithSummary("Gets history values of instance fields between 2 dates.") |
| | 131 | 35 | | .WithDescription("Gets history values of instance fields between 2 dates.") |
| | 131 | 36 | | .Produces<HistoryResultModel>(StatusCodes.Status200OK) |
| | 131 | 37 | | .Produces<string>(StatusCodes.Status404NotFound) |
| | 131 | 38 | | .Produces<string>(StatusCodes.Status400BadRequest); |
| | | 39 | | |
| | 131 | 40 | | historyValuesApi.MapPost("/{projectId}/{instanceName}/statistics/raw", |
| | 131 | 41 | | (IHistoryValuesService historyValuesService, |
| | 131 | 42 | | [Description("ID of project")] string projectId, |
| | 131 | 43 | | [Description("Name of instance")] string instanceName, |
| | 131 | 44 | | [Description("History request")][FromBody] HistoryStatisticsRequestModel request) |
| | 5 | 45 | | => GetHistoryRawStatistics.Handle(historyValuesService, projectId, instanceName, request)) |
| | 131 | 46 | | .WithName("GetInstanceStatisticsRawValuesHistory") |
| | 131 | 47 | | .WithDisplayName("GetInstanceStatisticsRawValuesHistory") |
| | 131 | 48 | | .WithSummary("Gets history raw values of instance fields between 2 dates.") |
| | 131 | 49 | | .WithDescription("Gets history raw values of instance fields between 2 dates.") |
| | 131 | 50 | | .Produces<HistoryStatisticsRawResultModel>(StatusCodes.Status200OK) |
| | 131 | 51 | | .Produces<string>(StatusCodes.Status404NotFound) |
| | 131 | 52 | | .Produces<string>(StatusCodes.Status400BadRequest); |
| | 131 | 53 | | historyValuesApi.MapPost("/{projectId}/{instanceName}/statistics", |
| | 131 | 54 | | (IHistoryValuesService historyValuesService, |
| | 131 | 55 | | [Description("ID of project")] string projectId, |
| | 131 | 56 | | [Description("Name of instance")] string instanceName, |
| | 131 | 57 | | [Description("History request")][FromBody] HistoryStatisticsRequestModel request) |
| | 5 | 58 | | => GetHistoryStatistics.Handle(historyValuesService, projectId, instanceName, request)) |
| | 131 | 59 | | .WithName("GetInstanceStatisticsHistory") |
| | 131 | 60 | | .WithDisplayName("GetInstanceStatisticsHistory") |
| | 131 | 61 | | .WithSummary("Gets history statistics of instance fields between 2 dates.") |
| | 131 | 62 | | .WithDescription("Gets history statistics of instance fields between 2 dates.") |
| | 131 | 63 | | .Produces<HistoryStatisticsResultModel>(StatusCodes.Status200OK) |
| | 131 | 64 | | .Produces<string>(StatusCodes.Status404NotFound) |
| | 131 | 65 | | .Produces<string>(StatusCodes.Status400BadRequest); |
| | | 66 | | |
| | 131 | 67 | | return app; |
| | 131 | 68 | | } |
| | | 69 | | } |
| | | 70 | | } |