Добавить DocumentationFile, описание контроллеров

This commit is contained in:
Roman Efremov 2024-11-27 13:08:06 +05:00
parent 0234f2096d
commit dc66522c0f
6 changed files with 193 additions and 103 deletions

View File

@ -4,6 +4,10 @@ using Persistence.Repositories;
using Persistence.Repository.Data;
namespace Persistence.API.Controllers;
/// <summary>
/// <20>אבמעא ס גנולוםם<D79D>לט האםם<D79D>לט
/// </summary>
[ApiController]
[Authorize]
[Route("api/[controller]")]

View File

@ -3,8 +3,11 @@ using Microsoft.AspNetCore.Mvc;
using Persistence.Models;
using Persistence.Repositories;
namespace Persistence.API.Controllers
{
namespace Persistence.API.Controllers;
/// <summary>
/// Работа с уставками
/// </summary>
[ApiController]
[Authorize]
[Route("api/[controller]")]
@ -17,6 +20,12 @@ namespace Persistence.API.Controllers
this.setpointRepository = setpointRepository;
}
/// <summary>
/// Получить актуальные значения уставок
/// </summary>
/// <param name="setpointKeys"></param>
/// <param name="token"></param>
/// <returns></returns>
[HttpGet("current")]
public async Task<ActionResult<IEnumerable<SetpointValueDto>>> GetCurrent([FromQuery] IEnumerable<Guid> setpointKeys, CancellationToken token)
{
@ -25,6 +34,13 @@ namespace Persistence.API.Controllers
return Ok(result);
}
/// <summary>
/// Получить значения уставок за определенный момент времени
/// </summary>
/// <param name="setpointKeys"></param>
/// <param name="historyMoment"></param>
/// <param name="token"></param>
/// <returns></returns>
[HttpGet("history")]
public async Task<ActionResult<IEnumerable<SetpointValueDto>>> GetHistory([FromQuery] IEnumerable<Guid> setpointKeys, [FromQuery] DateTimeOffset historyMoment, CancellationToken token)
{
@ -33,6 +49,12 @@ namespace Persistence.API.Controllers
return Ok(result);
}
/// <summary>
/// Получить историю изменений значений уставок
/// </summary>
/// <param name="setpointKeys"></param>
/// <param name="token"></param>
/// <returns></returns>
[HttpGet("log")]
public async Task<ActionResult<Dictionary<Guid, IEnumerable<SetpointLogDto>>>> GetLog([FromQuery] IEnumerable<Guid> setpointKeys, CancellationToken token)
{
@ -41,6 +63,13 @@ namespace Persistence.API.Controllers
return Ok(result);
}
/// <summary>
/// Сохранить уставку
/// </summary>
/// <param name="setpointKey"></param>
/// <param name="newValue"></param>
/// <param name="token"></param>
/// <returns></returns>
[HttpPost]
public async Task<ActionResult<int>> Save(Guid setpointKey, object newValue, CancellationToken token)
{
@ -50,4 +79,3 @@ namespace Persistence.API.Controllers
return Ok();
}
}
}

View File

@ -3,8 +3,11 @@ using Microsoft.AspNetCore.Mvc;
using Persistence.Models;
using Persistence.Repositories;
namespace Persistence.API.Controllers
{
namespace Persistence.API.Controllers;
/// <summary>
/// Работа с состояниями систем автобурения (АБ)
/// </summary>
[ApiController]
[Authorize]
[Route("api/[controller]")]
@ -17,6 +20,12 @@ namespace Persistence.API.Controllers
this.techMessagesRepository = techMessagesRepository;
}
/// <summary>
/// Получить список технологических сообщений в виде страницы
/// </summary>
/// <param name="request"></param>
/// <param name="token"></param>
/// <returns></returns>
[HttpGet]
public async Task<ActionResult<PaginationContainer<TechMessageDto>>> GetPage([FromQuery] RequestDto request, CancellationToken token)
{
@ -25,6 +34,13 @@ namespace Persistence.API.Controllers
return Ok(result);
}
/// <summary>
/// Получить статистику по системам
/// </summary>
/// <param name="importantId"></param>
/// <param name="autoDrillingSystem"></param>
/// <param name="token"></param>
/// <returns></returns>
[HttpGet("statistics")]
public async Task<ActionResult<int>> GetStatistics(int importantId, string autoDrillingSystem, CancellationToken token)
{
@ -33,6 +49,11 @@ namespace Persistence.API.Controllers
return Ok(result);
}
/// <summary>
/// Получить список всех систем
/// </summary>
/// <param name="token"></param>
/// <returns></returns>
[HttpGet("systems")]
public async Task<ActionResult<IEnumerable<string>>> GetSystems(CancellationToken token)
{
@ -41,6 +62,12 @@ namespace Persistence.API.Controllers
return Ok(result);
}
/// <summary>
/// Добавить новые технологические сообщения
/// </summary>
/// <param name="dtos"></param>
/// <param name="token"></param>
/// <returns></returns>
[HttpPost]
public async Task<ActionResult<int>> InsertRange([FromBody] IEnumerable<TechMessageDto> dtos, CancellationToken token)
{
@ -49,6 +76,10 @@ namespace Persistence.API.Controllers
return CreatedAtAction(nameof(InsertRange), result);
}
/// <summary>
/// Получить словарь категорий
/// </summary>
/// <returns></returns>
[HttpGet("categories")]
public ActionResult<Dictionary<int, string>> GetImportantCategories()
{
@ -64,4 +95,3 @@ namespace Persistence.API.Controllers
return Ok(result);
}
}
}

View File

@ -4,6 +4,7 @@ using Persistence.Models;
using Persistence.Repositories;
namespace Persistence.API.Controllers;
[ApiController]
[Authorize]
[Route("api/[controller]")]
@ -17,6 +18,12 @@ public class TimeSeriesController<TDto> : ControllerBase, ITimeSeriesDataApi<TDt
this.timeSeriesDataRepository = timeSeriesDataRepository;
}
/// <summary>
/// Ïîëó÷èòü ñïèñîê îáúåêòîâ, óäîâëåòâîðÿþùèé äèàïàçîíó äàò
/// </summary>
/// <param name="dateBegin"></param>
/// <param name="token"></param>
/// <returns></returns>
[HttpGet]
[ProducesResponseType(StatusCodes.Status200OK)]
public async Task<IActionResult> Get(DateTimeOffset dateBegin, CancellationToken token)
@ -25,6 +32,11 @@ public class TimeSeriesController<TDto> : ControllerBase, ITimeSeriesDataApi<TDt
return Ok(result);
}
/// <summary>
/// Ïîëó÷èòü äèàïàçîí äàò, äëÿ êîòîðûõ åñòü äàííûå â ðåïîçèòîðèå
/// </summary>
/// <param name="token"></param>
/// <returns></returns>
[HttpGet("datesRange")]
public async Task<IActionResult> GetDatesRange(CancellationToken token)
{
@ -32,6 +44,14 @@ public class TimeSeriesController<TDto> : ControllerBase, ITimeSeriesDataApi<TDt
return Ok(result);
}
/// <summary>
/// Ïîëó÷èòü ñïèñîê îáúåêòîâ ñ ïðîðåæèâàíèåì, óäîâëåòâîðÿþùèé äèàïàçîíó äàò
/// </summary>
/// <param name="dateBegin"></param>
/// <param name="intervalSec"></param>
/// <param name="approxPointsCount"></param>
/// <param name="token"></param>
/// <returns></returns>
[HttpGet("resampled")]
public async Task<IActionResult> GetResampledData(DateTimeOffset dateBegin, double intervalSec = 600d, int approxPointsCount = 1024, CancellationToken token = default)
{
@ -39,6 +59,12 @@ public class TimeSeriesController<TDto> : ControllerBase, ITimeSeriesDataApi<TDt
return Ok(result);
}
/// <summary>
/// Äîáàâèòü çàïèñè
/// </summary>
/// <param name="dtos"></param>
/// <param name="token"></param>
/// <returns></returns>
[HttpPost]
public async Task<IActionResult> InsertRange(IEnumerable<TDto> dtos, CancellationToken token)
{

View File

@ -1,3 +1,4 @@
using System.Reflection;
using System.Text.Json.Nodes;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.IdentityModel.Tokens;
@ -38,11 +39,10 @@ public static class DependencyInjection
c.AddKeycloackSecurity(configuration);
else c.AddDefaultSecurity(configuration);
//var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
//var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
//var includeControllerXmlComment = true;
//options.IncludeXmlComments(xmlPath, includeControllerXmlComment);
//options.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, "AsbCloudApp.xml"), includeControllerXmlComment);
var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
var includeControllerXmlComment = true;
c.IncludeXmlComments(xmlPath, includeControllerXmlComment);
});
}

View File

@ -5,6 +5,8 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>
</PropertyGroup>
<ItemGroup>