diff --git a/Persistence.API/Controllers/DataSaubController.cs b/Persistence.API/Controllers/DataSaubController.cs
index 63069a9..437aee3 100644
--- a/Persistence.API/Controllers/DataSaubController.cs
+++ b/Persistence.API/Controllers/DataSaubController.cs
@@ -4,6 +4,10 @@ using Persistence.Repositories;
using Persistence.Repository.Data;
namespace Persistence.API.Controllers;
+
+///
+///
+///
[ApiController]
[Authorize]
[Route("api/[controller]")]
diff --git a/Persistence.API/Controllers/SetpointController.cs b/Persistence.API/Controllers/SetpointController.cs
index 9a6bd61..5a5cb52 100644
--- a/Persistence.API/Controllers/SetpointController.cs
+++ b/Persistence.API/Controllers/SetpointController.cs
@@ -3,51 +3,79 @@ using Microsoft.AspNetCore.Mvc;
using Persistence.Models;
using Persistence.Repositories;
-namespace Persistence.API.Controllers
+namespace Persistence.API.Controllers;
+
+///
+/// Работа с уставками
+///
+[ApiController]
+[Authorize]
+[Route("api/[controller]")]
+public class SetpointController : ControllerBase, ISetpointApi
{
- [ApiController]
- [Authorize]
- [Route("api/[controller]")]
- public class SetpointController : ControllerBase, ISetpointApi
+ private readonly ISetpointRepository setpointRepository;
+
+ public SetpointController(ISetpointRepository setpointRepository)
{
- private readonly ISetpointRepository setpointRepository;
+ this.setpointRepository = setpointRepository;
+ }
- public SetpointController(ISetpointRepository setpointRepository)
- {
- this.setpointRepository = setpointRepository;
- }
+ ///
+ /// Получить актуальные значения уставок
+ ///
+ ///
+ ///
+ ///
+ [HttpGet("current")]
+ public async Task>> GetCurrent([FromQuery] IEnumerable setpointKeys, CancellationToken token)
+ {
+ var result = await setpointRepository.GetCurrent(setpointKeys, token);
- [HttpGet("current")]
- public async Task>> GetCurrent([FromQuery] IEnumerable setpointKeys, CancellationToken token)
- {
- var result = await setpointRepository.GetCurrent(setpointKeys, token);
+ return Ok(result);
+ }
- return Ok(result);
- }
+ ///
+ /// Получить значения уставок за определенный момент времени
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpGet("history")]
+ public async Task>> GetHistory([FromQuery] IEnumerable setpointKeys, [FromQuery] DateTimeOffset historyMoment, CancellationToken token)
+ {
+ var result = await setpointRepository.GetHistory(setpointKeys, historyMoment, token);
- [HttpGet("history")]
- public async Task>> GetHistory([FromQuery] IEnumerable setpointKeys, [FromQuery] DateTimeOffset historyMoment, CancellationToken token)
- {
- var result = await setpointRepository.GetHistory(setpointKeys, historyMoment, token);
+ return Ok(result);
+ }
- return Ok(result);
- }
+ ///
+ /// Получить историю изменений значений уставок
+ ///
+ ///
+ ///
+ ///
+ [HttpGet("log")]
+ public async Task>>> GetLog([FromQuery] IEnumerable setpointKeys, CancellationToken token)
+ {
+ var result = await setpointRepository.GetLog(setpointKeys, token);
- [HttpGet("log")]
- public async Task>>> GetLog([FromQuery] IEnumerable setpointKeys, CancellationToken token)
- {
- var result = await setpointRepository.GetLog(setpointKeys, token);
+ return Ok(result);
+ }
- return Ok(result);
- }
+ ///
+ /// Сохранить уставку
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task> Save(Guid setpointKey, object newValue, CancellationToken token)
+ {
+ // ToDo: вычитка idUser
+ await setpointRepository.Save(setpointKey, newValue, 0, token);
- [HttpPost]
- public async Task> Save(Guid setpointKey, object newValue, CancellationToken token)
- {
- // ToDo: вычитка idUser
- await setpointRepository.Save(setpointKey, newValue, 0, token);
-
- return Ok();
- }
+ return Ok();
}
}
diff --git a/Persistence.API/Controllers/TechMessagesController.cs b/Persistence.API/Controllers/TechMessagesController.cs
index 676ae8e..7411c19 100644
--- a/Persistence.API/Controllers/TechMessagesController.cs
+++ b/Persistence.API/Controllers/TechMessagesController.cs
@@ -3,65 +3,95 @@ using Microsoft.AspNetCore.Mvc;
using Persistence.Models;
using Persistence.Repositories;
-namespace Persistence.API.Controllers
+namespace Persistence.API.Controllers;
+
+///
+/// Работа с состояниями систем автобурения (АБ)
+///
+[ApiController]
+[Authorize]
+[Route("api/[controller]")]
+public class TechMessagesController : ControllerBase, ITechMessages
{
- [ApiController]
- [Authorize]
- [Route("api/[controller]")]
- public class TechMessagesController : ControllerBase, ITechMessages
+ private readonly ITechMessagesRepository techMessagesRepository;
+
+ public TechMessagesController(ITechMessagesRepository techMessagesRepository)
{
- private readonly ITechMessagesRepository techMessagesRepository;
+ this.techMessagesRepository = techMessagesRepository;
+ }
- public TechMessagesController(ITechMessagesRepository techMessagesRepository)
+ ///
+ /// Получить список технологических сообщений в виде страницы
+ ///
+ ///
+ ///
+ ///
+ [HttpGet]
+ public async Task>> GetPage([FromQuery] RequestDto request, CancellationToken token)
+ {
+ var result = await techMessagesRepository.GetPage(request, token);
+
+ return Ok(result);
+ }
+
+ ///
+ /// Получить статистику по системам
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpGet("statistics")]
+ public async Task> GetStatistics(int importantId, string autoDrillingSystem, CancellationToken token)
+ {
+ var result = await techMessagesRepository.GetStatistics(importantId, autoDrillingSystem, token);
+
+ return Ok(result);
+ }
+
+ ///
+ /// Получить список всех систем
+ ///
+ ///
+ ///
+ [HttpGet("systems")]
+ public async Task>> GetSystems(CancellationToken token)
+ {
+ var result = await techMessagesRepository.GetSystems(token);
+
+ return Ok(result);
+ }
+
+ ///
+ /// Добавить новые технологические сообщения
+ ///
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task> InsertRange([FromBody] IEnumerable dtos, CancellationToken token)
+ {
+ var result = await techMessagesRepository.InsertRange(dtos, token);
+
+ return CreatedAtAction(nameof(InsertRange), result);
+ }
+
+ ///
+ /// Получить словарь категорий
+ ///
+ ///
+ [HttpGet("categories")]
+ public ActionResult> GetImportantCategories()
+ {
+ var result = new Dictionary()
{
- this.techMessagesRepository = techMessagesRepository;
- }
+ { 0, "System" },
+ { 1, "Авария" },
+ { 2, "Предупреждение" },
+ { 3, "Инфо" },
+ { 4, "Прочее" }
+ };
- [HttpGet]
- public async Task>> GetPage([FromQuery] RequestDto request, CancellationToken token)
- {
- var result = await techMessagesRepository.GetPage(request, token);
-
- return Ok(result);
- }
-
- [HttpGet("statistics")]
- public async Task> GetStatistics(int importantId, string autoDrillingSystem, CancellationToken token)
- {
- var result = await techMessagesRepository.GetStatistics(importantId, autoDrillingSystem, token);
-
- return Ok(result);
- }
-
- [HttpGet("systems")]
- public async Task>> GetSystems(CancellationToken token)
- {
- var result = await techMessagesRepository.GetSystems(token);
-
- return Ok(result);
- }
-
- [HttpPost]
- public async Task> InsertRange([FromBody] IEnumerable dtos, CancellationToken token)
- {
- var result = await techMessagesRepository.InsertRange(dtos, token);
-
- return CreatedAtAction(nameof(InsertRange), result);
- }
-
- [HttpGet("categories")]
- public ActionResult> GetImportantCategories()
- {
- var result = new Dictionary()
- {
- { 0, "System" },
- { 1, "Авария" },
- { 2, "Предупреждение" },
- { 3, "Инфо" },
- { 4, "Прочее" }
- };
-
- return Ok(result);
- }
+ return Ok(result);
}
}
diff --git a/Persistence.API/Controllers/TimeSeriesController.cs b/Persistence.API/Controllers/TimeSeriesController.cs
index a4a860a..a4f00f3 100644
--- a/Persistence.API/Controllers/TimeSeriesController.cs
+++ b/Persistence.API/Controllers/TimeSeriesController.cs
@@ -4,6 +4,7 @@ using Persistence.Models;
using Persistence.Repositories;
namespace Persistence.API.Controllers;
+
[ApiController]
[Authorize]
[Route("api/[controller]")]
@@ -12,12 +13,18 @@ public class TimeSeriesController : ControllerBase, ITimeSeriesDataApi timeSeriesDataRepository;
- public TimeSeriesController(ITimeSeriesDataRepository timeSeriesDataRepository)
- {
- this.timeSeriesDataRepository = timeSeriesDataRepository;
+ public TimeSeriesController(ITimeSeriesDataRepository timeSeriesDataRepository)
+ {
+ this.timeSeriesDataRepository = timeSeriesDataRepository;
}
- [HttpGet]
+ ///
+ /// ,
+ ///
+ ///
+ ///
+ ///
+ [HttpGet]
[ProducesResponseType(StatusCodes.Status200OK)]
public async Task Get(DateTimeOffset dateBegin, CancellationToken token)
{
@@ -25,21 +32,40 @@ public class TimeSeriesController : ControllerBase, ITimeSeriesDataApi
+ /// ,
+ ///
+ ///
+ ///
+ [HttpGet("datesRange")]
public async Task GetDatesRange(CancellationToken token)
{
var result = await this.timeSeriesDataRepository.GetDatesRange(token);
return Ok(result);
}
- [HttpGet("resampled")]
+ ///
+ /// ,
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpGet("resampled")]
public async Task GetResampledData(DateTimeOffset dateBegin, double intervalSec = 600d, int approxPointsCount = 1024, CancellationToken token = default)
{
var result = await this.timeSeriesDataRepository.GetResampledData(dateBegin, intervalSec, approxPointsCount, token);
return Ok(result);
}
- [HttpPost]
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpPost]
public async Task InsertRange(IEnumerable dtos, CancellationToken token)
{
var result = await this.timeSeriesDataRepository.InsertRange(dtos, token);
diff --git a/Persistence.API/DependencyInjection.cs b/Persistence.API/DependencyInjection.cs
index cdfca4c..5d7c646 100644
--- a/Persistence.API/DependencyInjection.cs
+++ b/Persistence.API/DependencyInjection.cs
@@ -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);
});
}
diff --git a/Persistence.API/Persistence.API.csproj b/Persistence.API/Persistence.API.csproj
index c14b509..dfff363 100644
--- a/Persistence.API/Persistence.API.csproj
+++ b/Persistence.API/Persistence.API.csproj
@@ -5,6 +5,8 @@
enable
enable
Linux
+ True
+ $(NoWarn);1591