diff --git a/DD.Persistence.API/Controllers/ChangeLogController.cs b/DD.Persistence.API/Controllers/ChangeLogController.cs
index 21761e1..8b788c4 100644
--- a/DD.Persistence.API/Controllers/ChangeLogController.cs
+++ b/DD.Persistence.API/Controllers/ChangeLogController.cs
@@ -4,6 +4,7 @@ using DD.Persistence.Models;
using DD.Persistence.Models.Requests;
using DD.Persistence.Repositories;
using System.Net;
+using DD.Persistence.Models.Common;
namespace DD.Persistence.API.Controllers;
diff --git a/DD.Persistence.API/Controllers/DataSaubController.cs b/DD.Persistence.API/Controllers/DataSaubController.cs
deleted file mode 100644
index 832faec..0000000
--- a/DD.Persistence.API/Controllers/DataSaubController.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Mvc;
-using DD.Persistence.Models;
-using DD.Persistence.Repositories;
-
-namespace DD.Persistence.API.Controllers;
-
-///
-/// Работа с временными данными
-///
-[ApiController]
-[Authorize]
-[Route("api/[controller]")]
-public class DataSaubController : TimeSeriesController
-{
- public DataSaubController(ITimeSeriesDataRepository timeSeriesDataRepository) : base(timeSeriesDataRepository)
- {
-
- }
-}
diff --git a/DD.Persistence.API/Controllers/SetpointController.cs b/DD.Persistence.API/Controllers/SetpointController.cs
index 0850438..2f1c6fc 100644
--- a/DD.Persistence.API/Controllers/SetpointController.cs
+++ b/DD.Persistence.API/Controllers/SetpointController.cs
@@ -4,6 +4,7 @@ using DD.Persistence.Models;
using DD.Persistence.Repositories;
using System.Net;
using System.Text.Json;
+using DD.Persistence.Models.Common;
namespace DD.Persistence.API.Controllers;
diff --git a/DD.Persistence.API/Controllers/TechMessagesController.cs b/DD.Persistence.API/Controllers/TechMessagesController.cs
index 81663e0..cd98e42 100644
--- a/DD.Persistence.API/Controllers/TechMessagesController.cs
+++ b/DD.Persistence.API/Controllers/TechMessagesController.cs
@@ -4,6 +4,7 @@ using DD.Persistence.Models;
using DD.Persistence.Models.Requests;
using DD.Persistence.Repositories;
using System.Net;
+using DD.Persistence.Models.Common;
namespace DD.Persistence.API.Controllers;
diff --git a/DD.Persistence.API/Controllers/TimeSeriesController.cs b/DD.Persistence.API/Controllers/TimeSeriesController.cs
deleted file mode 100644
index 5fded36..0000000
--- a/DD.Persistence.API/Controllers/TimeSeriesController.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Mvc;
-using DD.Persistence.Models;
-using DD.Persistence.Repositories;
-
-namespace DD.Persistence.API.Controllers;
-
-[ApiController]
-[Authorize]
-[Route("api/[controller]")]
-public class TimeSeriesController : ControllerBase, ITimeSeriesDataApi
- where TDto : class, ITimeSeriesAbstractDto, new()
-{
- private readonly ITimeSeriesDataRepository timeSeriesDataRepository;
-
- public TimeSeriesController(ITimeSeriesDataRepository timeSeriesDataRepository)
- {
- this.timeSeriesDataRepository = timeSeriesDataRepository;
- }
-
- ///
- /// Получить список объектов, удовлетворяющий диапазону дат
- ///
- ///
- ///
- ///
- [HttpGet]
- [ProducesResponseType(StatusCodes.Status200OK)]
- public async Task Get(DateTimeOffset dateBegin, CancellationToken token)
- {
- var result = await timeSeriesDataRepository.GetGtDate(dateBegin, token);
- return Ok(result);
- }
-
- ///
- /// Получить диапазон дат, для которых есть данные в репозитории
- ///
- ///
- ///
- [HttpGet("datesRange")]
- public async Task GetDatesRange(CancellationToken token)
- {
- var result = await timeSeriesDataRepository.GetDatesRange(token);
- return Ok(result);
- }
-
- ///
- /// Получить список объектов с прореживанием, удовлетворяющий диапазону дат
- ///
- ///
- ///
- ///
- ///
- ///
- [HttpGet("resampled")]
- public async Task GetResampledData(DateTimeOffset dateBegin, double intervalSec = 600d, int approxPointsCount = 1024, CancellationToken token = default)
- {
- var result = await timeSeriesDataRepository.GetResampledData(dateBegin, intervalSec, approxPointsCount, token);
- return Ok(result);
- }
-
- ///
- /// Добавить записи
- ///
- ///
- ///
- ///
- [HttpPost]
- public async Task AddRange(IEnumerable dtos, CancellationToken token)
- {
- var result = await timeSeriesDataRepository.AddRange(dtos, token);
- return Ok(result);
- }
-
-
-}
diff --git a/DD.Persistence.API/Controllers/TimestampedSetController.cs b/DD.Persistence.API/Controllers/TimestampedSetController.cs
deleted file mode 100644
index 0c805ab..0000000
--- a/DD.Persistence.API/Controllers/TimestampedSetController.cs
+++ /dev/null
@@ -1,104 +0,0 @@
-using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Mvc;
-using DD.Persistence.Models;
-using DD.Persistence.Repositories;
-using System.Net;
-
-namespace DD.Persistence.API.Controllers;
-
-///
-/// Хранение наборов данных с отметкой времени.
-/// Не оптимизировано под большие данные.
-///
-[ApiController]
-[Authorize]
-[Route("api/[controller]/{idDiscriminator}")]
-public class TimestampedSetController : ControllerBase
-{
- private readonly ITimestampedSetRepository repository;
-
- public TimestampedSetController(ITimestampedSetRepository repository)
- {
- this.repository = repository;
- }
-
- ///
- /// Записать новые данные
- /// Предполагается что данные с одним дискриминатором имеют одинаковую структуру
- ///
- /// Дискриминатор (идентификатор) набора
- ///
- ///
- /// кол-во затронутых записей
- [HttpPost]
- [ProducesResponseType(typeof(int), (int)HttpStatusCode.OK)]
- public async Task AddRange([FromRoute] Guid idDiscriminator, [FromBody] IEnumerable sets, CancellationToken token)
- {
- var result = await repository.AddRange(idDiscriminator, sets, token);
- return Ok(result);
- }
-
- ///
- /// Получение данных с фильтрацией. Значение фильтра null - отключен
- ///
- /// Дискриминатор (идентификатор) набора
- /// Фильтр позднее даты
- /// Фильтр свойств набора. Можно запросить только некоторые свойства из набора
- ///
- ///
- ///
- /// Фильтрованный набор данных с сортировкой по отметке времени
- [HttpGet]
- [ProducesResponseType(typeof(IEnumerable), (int)HttpStatusCode.OK)]
- public async Task Get(Guid idDiscriminator, DateTimeOffset? geTimestamp, [FromQuery] IEnumerable? columnNames, int skip, int take, CancellationToken token)
- {
- var result = await repository.Get(idDiscriminator, geTimestamp, columnNames, skip, take, token);
- return Ok(result);
- }
-
- ///
- /// Получить последние данные
- ///
- /// Дискриминатор (идентификатор) набора
- /// Фильтр свойств набора. Можно запросить только некоторые свойства из набора
- ///
- ///
- /// Фильтрованный набор данных с сортировкой по отметке времени
- [HttpGet("last")]
- [ProducesResponseType(typeof(IEnumerable), (int)HttpStatusCode.OK)]
- public async Task GetLast(Guid idDiscriminator, [FromQuery] IEnumerable? columnNames, int take, CancellationToken token)
- {
- var result = await repository.GetLast(idDiscriminator, columnNames, take, token);
- return Ok(result);
- }
-
- ///
- /// Диапазон дат за которые есть данные
- ///
- ///
- ///
- /// Дата первой и последней записи
- [HttpGet("datesRange")]
- [ProducesResponseType(typeof(DatesRangeDto), (int)HttpStatusCode.OK)]
- [ProducesResponseType((int)HttpStatusCode.NoContent)]
- public async Task GetDatesRange(Guid idDiscriminator, CancellationToken token)
- {
- var result = await repository.GetDatesRange(idDiscriminator, token);
- return Ok(result);
- }
-
- ///
- /// Количество записей по указанному набору в БД. Для пагинации.
- ///
- /// Дискриминатор (идентификатор) набора
- ///
- ///
- [HttpGet("count")]
- [ProducesResponseType(typeof(int), (int)HttpStatusCode.OK)]
- [ProducesResponseType((int)HttpStatusCode.NoContent)]
- public async Task Count(Guid idDiscriminator, CancellationToken token)
- {
- var result = await repository.Count(idDiscriminator, token);
- return Ok(result);
- }
-}
diff --git a/DD.Persistence.API/Controllers/TimestampedValuesController.cs b/DD.Persistence.API/Controllers/TimestampedValuesController.cs
new file mode 100644
index 0000000..abc1114
--- /dev/null
+++ b/DD.Persistence.API/Controllers/TimestampedValuesController.cs
@@ -0,0 +1,151 @@
+using DD.Persistence.Models;
+using DD.Persistence.Models.Common;
+using DD.Persistence.Services.Interfaces;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using System.Net;
+
+namespace DD.Persistence.API.Controllers;
+
+///
+/// Хранение наборов данных с отметкой времени.
+///
+[ApiController]
+[Authorize]
+[Route("api/[controller]/{discriminatorId}")]
+public class TimestampedValuesController : ControllerBase
+{
+ private readonly ITimestampedValuesService timestampedValuesRepository;
+
+ public TimestampedValuesController(ITimestampedValuesService repository)
+ {
+ this.timestampedValuesRepository = repository;
+ }
+
+ ///
+ /// Записать новые данные.
+ /// Предполагается что данные с одним дискриминатором имеют одинаковую структуру
+ ///
+ /// Дискриминатор (идентификатор) набора
+ ///
+ ///
+ [HttpPost]
+ [ProducesResponseType(typeof(int), (int)HttpStatusCode.Created)]
+ public async Task AddRange([FromRoute] Guid discriminatorId, [FromBody] IEnumerable dtos, CancellationToken token)
+ {
+ var result = await timestampedValuesRepository.AddRange(discriminatorId, dtos, token);
+
+ return CreatedAtAction(nameof(AddRange), result);
+ }
+
+ ///
+ /// Получение данных с фильтрацией. Значение фильтра null - отключен
+ ///
+ /// Дискриминатор (идентификатор) набора
+ /// Фильтр позднее даты
+ /// Фильтр свойств набора
+ ///
+ ///
+ ///
+ [HttpGet]
+ [ProducesResponseType(typeof(IEnumerable), (int)HttpStatusCode.OK)]
+ [ProducesResponseType((int)HttpStatusCode.NoContent)]
+ public async Task>> Get([FromRoute] Guid discriminatorId, DateTimeOffset? timestampBegin, [FromQuery] string[]? columnNames, int skip, int take, CancellationToken token)
+ {
+ var result = await timestampedValuesRepository.Get(discriminatorId, timestampBegin, columnNames, skip, take, token);
+
+ return result.Any() ? Ok(result) : NoContent();
+ }
+
+ ///
+ /// Получить данные, начиная с заданной отметки времени
+ ///
+ /// Дискриминатор (идентификатор) набора
+ /// Фильтр позднее даты
+ ///
+ [HttpGet("gtdate")]
+ [ProducesResponseType(typeof(IEnumerable), (int)HttpStatusCode.OK)]
+ [ProducesResponseType((int)HttpStatusCode.NoContent)]
+ public async Task>> GetGtDate([FromRoute] Guid discriminatorId, DateTimeOffset timestampBegin, CancellationToken token)
+ {
+ var result = await timestampedValuesRepository.GetGtDate(discriminatorId, timestampBegin, token);
+
+ return result.Any() ? Ok(result) : NoContent();
+ }
+
+ ///
+ /// Получить данные c начала
+ ///
+ /// Дискриминатор (идентификатор) набора
+ ///
+ ///
+ [HttpGet("first")]
+ [ProducesResponseType(typeof(IEnumerable), (int)HttpStatusCode.OK)]
+ [ProducesResponseType((int)HttpStatusCode.NoContent)]
+ public async Task>> GetFirst([FromRoute] Guid discriminatorId, int take, CancellationToken token)
+ {
+ var result = await timestampedValuesRepository.GetFirst(discriminatorId, take, token);
+
+ return result.Any() ? Ok(result) : NoContent();
+ }
+
+ ///
+ /// Получить данные c конца
+ ///
+ /// Дискриминатор (идентификатор) набора
+ ///
+ ///
+ [HttpGet("last")]
+ [ProducesResponseType(typeof(IEnumerable), (int)HttpStatusCode.OK)]
+ [ProducesResponseType((int)HttpStatusCode.NoContent)]
+ public async Task>> GetLast([FromRoute] Guid discriminatorId, int take, CancellationToken token)
+ {
+ var result = await timestampedValuesRepository.GetLast(discriminatorId, take, token);
+
+ return result.Any() ? Ok(result) : NoContent();
+ }
+
+ ///
+ /// Получить список объектов с прореживанием, удовлетворяющий диапазону дат
+ ///
+ /// Дискриминатор (идентификатор) набора
+ /// Фильтр позднее даты
+ ///
+ ///
+ ///
+ [HttpGet("resampled")]
+ [ProducesResponseType(typeof(IEnumerable), (int)HttpStatusCode.OK)]
+ [ProducesResponseType((int)HttpStatusCode.NoContent)]
+ public async Task>> GetResampledData([FromRoute] Guid discriminatorId, DateTimeOffset timestampBegin, double intervalSec = 600d, int approxPointsCount = 1024, CancellationToken token = default)
+ {
+ var result = await timestampedValuesRepository.GetResampledData(discriminatorId, timestampBegin, intervalSec, approxPointsCount, token);
+
+ return result.Any() ? Ok(result) : NoContent();
+ }
+
+ ///
+ /// Получить количество записей по указанному набору в БД. Для пагинации
+ ///
+ /// Дискриминатор (идентификатор) набора
+ ///
+ [HttpGet("count")]
+ public async Task> Count([FromRoute] Guid discriminatorId, CancellationToken token)
+ {
+ var result = await timestampedValuesRepository.Count(discriminatorId, token);
+
+ return Ok(result);
+ }
+
+ ///
+ /// Получить диапазон дат, в пределах которых хранятся даные
+ ///
+ ///
+ ///
+ [HttpGet("datesRange")]
+ public async Task> GetDatesRange([FromRoute] Guid discriminatorId, CancellationToken token)
+ {
+ var result = await timestampedValuesRepository.GetDatesRange(discriminatorId, token);
+
+ return Ok(result);
+ }
+}
diff --git a/DD.Persistence.API/Controllers/WitsDataController.cs b/DD.Persistence.API/Controllers/WitsDataController.cs
index 5df6c3f..c87345e 100644
--- a/DD.Persistence.API/Controllers/WitsDataController.cs
+++ b/DD.Persistence.API/Controllers/WitsDataController.cs
@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Mvc;
using DD.Persistence.Models;
using DD.Persistence.Services.Interfaces;
using System.Net;
+using DD.Persistence.Models.Common;
namespace DD.Persistence.API.Controllers;
diff --git a/DD.Persistence.API/DependencyInjection.cs b/DD.Persistence.API/DependencyInjection.cs
index 6b0754c..b543841 100644
--- a/DD.Persistence.API/DependencyInjection.cs
+++ b/DD.Persistence.API/DependencyInjection.cs
@@ -53,6 +53,7 @@ public static class DependencyInjection
public static void AddServices(this IServiceCollection services)
{
services.AddTransient();
+ services.AddTransient();
}
#region Authentication
diff --git a/DD.Persistence.App/appsettings.Tests.json b/DD.Persistence.App/appsettings.Tests.json
index 9934757..2c890bb 100644
--- a/DD.Persistence.App/appsettings.Tests.json
+++ b/DD.Persistence.App/appsettings.Tests.json
@@ -1,10 +1,10 @@
{
"DbConnection": {
- "Host": "localhost",
+ "Host": "postgres",
"Port": 5432,
"Database": "persistence",
"Username": "postgres",
- "Password": "postgres"
+ "Password": "q"
},
"NeedUseKeyCloak": false,
"AuthUser": {
diff --git a/DD.Persistence.Client/Clients/ChangeLogClient.cs b/DD.Persistence.Client/Clients/ChangeLogClient.cs
index 38c2ec4..e4f5904 100644
--- a/DD.Persistence.Client/Clients/ChangeLogClient.cs
+++ b/DD.Persistence.Client/Clients/ChangeLogClient.cs
@@ -4,6 +4,7 @@ using DD.Persistence.Client.Clients.Interfaces;
using DD.Persistence.Models;
using DD.Persistence.Models.Requests;
using DD.Persistence.Client.Clients.Interfaces.Refit;
+using DD.Persistence.Models.Common;
namespace DD.Persistence.Client.Clients;
public class ChangeLogClient : BaseClient, IChangeLogClient
diff --git a/DD.Persistence.Client/Clients/Interfaces/IChangeLogClient.cs b/DD.Persistence.Client/Clients/Interfaces/IChangeLogClient.cs
index 19edeab..f81ac8d 100644
--- a/DD.Persistence.Client/Clients/Interfaces/IChangeLogClient.cs
+++ b/DD.Persistence.Client/Clients/Interfaces/IChangeLogClient.cs
@@ -1,4 +1,5 @@
using DD.Persistence.Models;
+using DD.Persistence.Models.Common;
using DD.Persistence.Models.Requests;
namespace DD.Persistence.Client.Clients.Interfaces;
diff --git a/DD.Persistence.Client/Clients/Interfaces/ISetpointClient.cs b/DD.Persistence.Client/Clients/Interfaces/ISetpointClient.cs
index f197fe8..407eb1c 100644
--- a/DD.Persistence.Client/Clients/Interfaces/ISetpointClient.cs
+++ b/DD.Persistence.Client/Clients/Interfaces/ISetpointClient.cs
@@ -1,4 +1,5 @@
using DD.Persistence.Models;
+using DD.Persistence.Models.Common;
namespace DD.Persistence.Client.Clients.Interfaces;
diff --git a/DD.Persistence.Client/Clients/Interfaces/ITechMessagesClient.cs b/DD.Persistence.Client/Clients/Interfaces/ITechMessagesClient.cs
index a27e553..2af1af6 100644
--- a/DD.Persistence.Client/Clients/Interfaces/ITechMessagesClient.cs
+++ b/DD.Persistence.Client/Clients/Interfaces/ITechMessagesClient.cs
@@ -1,4 +1,5 @@
using DD.Persistence.Models;
+using DD.Persistence.Models.Common;
using DD.Persistence.Models.Requests;
namespace DD.Persistence.Client.Clients.Interfaces;
diff --git a/DD.Persistence.Client/Clients/Interfaces/ITimeSeriesClient.cs b/DD.Persistence.Client/Clients/Interfaces/ITimeSeriesClient.cs
deleted file mode 100644
index db619e5..0000000
--- a/DD.Persistence.Client/Clients/Interfaces/ITimeSeriesClient.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-using DD.Persistence.Models;
-
-namespace DD.Persistence.Client.Clients.Interfaces;
-
-///
-/// Клиент для работы с временными данными
-///
-///
-public interface ITimeSeriesClient : IDisposable where TDto : class, ITimeSeriesAbstractDto
-{
- ///
- /// Добавление записей
- ///
- ///
- ///
- ///
- Task AddRange(IEnumerable dtos, CancellationToken token);
-
- ///
- /// Получить список объектов, удовлетворяющий диапазону дат
- ///
- ///
- ///
- ///
- ///
- Task> Get(DateTimeOffset dateBegin, DateTimeOffset dateEnd, CancellationToken token);
-
- ///
- /// Получить диапазон дат, для которых есть данные в репозитории
- ///
- ///
- ///
- Task GetDatesRange(CancellationToken token);
-
- ///
- /// Получить список объектов с прореживанием, удовлетворяющий диапазону дат
- ///
- ///
- ///
- ///
- ///
- ///
- Task> GetResampledData(DateTimeOffset dateBegin, double intervalSec = 600, int approxPointsCount = 1024, CancellationToken token = default);
-}
\ No newline at end of file
diff --git a/DD.Persistence.Client/Clients/Interfaces/ITimestampedSetClient.cs b/DD.Persistence.Client/Clients/Interfaces/ITimestampedSetClient.cs
deleted file mode 100644
index 432cccb..0000000
--- a/DD.Persistence.Client/Clients/Interfaces/ITimestampedSetClient.cs
+++ /dev/null
@@ -1,82 +0,0 @@
-using DD.Persistence.Models;
-
-namespace DD.Persistence.Client.Clients.Interfaces;
-
-///
-/// Клиент для работы с репозиторием для хранения разных наборов данных рядов.
-/// idDiscriminator - идентифицирует конкретный набор данных, прим.: циклы измерения АСИБР, или отчет о DrillTest.
-/// idDiscriminator формируют клиенты и только им известно что они обозначают.
-/// Так как данные приходят редко, то их прореживания для построения графиков не предусмотрено.
-///
-public interface ITimestampedSetClient : IDisposable
-{
- ///
- /// Записать новые данные
- ///
- ///
- ///
- ///
- ///
- Task AddRange(Guid idDiscriminator, IEnumerable sets, CancellationToken token);
-
- ///
- /// Количество записей по указанному набору в БД. Для пагинации
- ///
- ///
- ///
- ///
- Task Count(Guid idDiscriminator, CancellationToken token);
-
- ///
- /// Получение данных с фильтрацией. Значение фильтра null - отключен
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- Task> Get(Guid idDiscriminator, DateTimeOffset? geTimestamp, IEnumerable? columnNames, int skip, int take, CancellationToken token);
-
- ///
- /// Получение данных с фильтрацией. Значение фильтра null - отключен
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- Task> Get(Guid idDiscriminator, DateTimeOffset? geTimestamp, IEnumerable? columnNames, int skip, int take, CancellationToken token);
-
-
- ///
- /// Диапазон дат за которые есть данные
- ///
- ///
- ///
- ///
- Task GetDatesRange(Guid idDiscriminator, CancellationToken token);
-
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- Task> GetLast(Guid idDiscriminator, IEnumerable? columnNames, int take, CancellationToken token);
-
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- Task> GetLast(Guid idDiscriminator, IEnumerable? columnNames, int take, CancellationToken token);
-}
\ No newline at end of file
diff --git a/DD.Persistence.Client/Clients/Interfaces/ITimestampedValuesClient.cs b/DD.Persistence.Client/Clients/Interfaces/ITimestampedValuesClient.cs
new file mode 100644
index 0000000..b0ea180
--- /dev/null
+++ b/DD.Persistence.Client/Clients/Interfaces/ITimestampedValuesClient.cs
@@ -0,0 +1,103 @@
+using DD.Persistence.Models;
+using DD.Persistence.Models.Common;
+
+namespace DD.Persistence.Client.Clients.Interfaces;
+
+///
+/// Клиент для работы с наборами данных, имеющими отметку времени.
+/// discriminatorId - идентифицирует конкретный набор данных, прим.: циклы измерения АСИБР, или отчет о DrillTest.
+/// discriminatorId формируют клиенты и только им известно что они обозначают.
+///
+public interface ITimestampedValuesClient : IDisposable
+{
+ ///
+ /// Записать новые данные
+ /// Предполагается что данные с одним дискриминатором имеют одинаковую структуру
+ ///
+ /// Дискриминатор (идентификатор) набора
+ ///
+ ///
+ Task AddRange(Guid discriminatorId, IEnumerable dtos, CancellationToken token);
+
+ ///
+ /// Получить данные с фильтрацией. Значение фильтра null - отключен
+ ///
+ /// Дискриминатор (идентификатор) набора
+ /// Фильтр позднее даты
+ /// Фильтр свойств набора
+ ///
+ ///
+ ///
+ Task> Get(Guid discriminatorId, DateTimeOffset? timestampBegin, IEnumerable? columnNames, int skip, int take, CancellationToken token);
+
+ ///
+ /// Получить данные, начиная с заданной отметки времени
+ ///
+ /// Дискриминатор (идентификатор) набора
+ /// Фильтр позднее даты
+ ///
+ Task> GetGtDate(Guid discriminatorId, DateTimeOffset timestampBegin, CancellationToken token);
+
+ ///
+ /// Получить данные с начала
+ ///
+ /// Дискриминатор (идентификатор) набора
+ ///
+ ///
+ Task> GetFirst(Guid discriminatorId, int take, CancellationToken token);
+
+ ///
+ /// Получить данные с конца
+ ///
+ /// Дискриминатор (идентификатор) набора
+ ///
+ ///
+ Task> GetLast(Guid discriminatorId, int take, CancellationToken token);
+
+ ///
+ /// Получить данные с прореживанием, удовлетворяющем диапазону дат
+ ///
+ /// Дискриминатор (идентификатор) набора
+ ///
+ ///
+ ///
+ ///
+ Task> GetResampledData(Guid discriminatorId, DateTimeOffset timestampBegin, double intervalSec = 600d, int approxPointsCount = 1024, CancellationToken token = default);
+
+ ///
+ /// Количество записей по указанному набору в БД. Для пагинации
+ ///
+ /// Дискриминатор (идентификатор) набора
+ ///
+ Task Count(Guid discriminatorId, CancellationToken token);
+
+ ///
+ /// Диапазон дат, в пределах которых осуществляется хранение данных
+ ///
+ /// Дискриминатор (идентификатор) набора
+ ///
+ Task GetDatesRange(Guid discriminatorId, CancellationToken token);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ Task> Get(Guid idDiscriminator, DateTimeOffset? geTimestamp, IEnumerable? columnNames, int skip, int take, CancellationToken token);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ Task> GetLast(Guid idDiscriminator, int take, CancellationToken token);
+}
\ No newline at end of file
diff --git a/DD.Persistence.Client/Clients/Interfaces/IWitsDataClient.cs b/DD.Persistence.Client/Clients/Interfaces/IWitsDataClient.cs
index e954484..0ac015d 100644
--- a/DD.Persistence.Client/Clients/Interfaces/IWitsDataClient.cs
+++ b/DD.Persistence.Client/Clients/Interfaces/IWitsDataClient.cs
@@ -1,4 +1,5 @@
using DD.Persistence.Models;
+using DD.Persistence.Models.Common;
using Refit;
namespace DD.Persistence.Client.Clients.Interfaces;
diff --git a/DD.Persistence.Client/Clients/Interfaces/Refit/IRefitChangeLogClient.cs b/DD.Persistence.Client/Clients/Interfaces/Refit/IRefitChangeLogClient.cs
index 83c240f..8e35b4e 100644
--- a/DD.Persistence.Client/Clients/Interfaces/Refit/IRefitChangeLogClient.cs
+++ b/DD.Persistence.Client/Clients/Interfaces/Refit/IRefitChangeLogClient.cs
@@ -1,4 +1,5 @@
using DD.Persistence.Models;
+using DD.Persistence.Models.Common;
using DD.Persistence.Models.Requests;
using Refit;
diff --git a/DD.Persistence.Client/Clients/Interfaces/Refit/IRefitClient.cs b/DD.Persistence.Client/Clients/Interfaces/Refit/IRefitClient.cs
index 9568a51..4a140e0 100644
--- a/DD.Persistence.Client/Clients/Interfaces/Refit/IRefitClient.cs
+++ b/DD.Persistence.Client/Clients/Interfaces/Refit/IRefitClient.cs
@@ -5,6 +5,10 @@ using System.Text;
using System.Threading.Tasks;
namespace DD.Persistence.Client.Clients.Interfaces.Refit;
+
+///
+/// Базовый Refit интерфейс
+///
public interface IRefitClient
{
}
diff --git a/DD.Persistence.Client/Clients/Interfaces/Refit/IRefitSetpointClient.cs b/DD.Persistence.Client/Clients/Interfaces/Refit/IRefitSetpointClient.cs
index 1cd2742..7931e6d 100644
--- a/DD.Persistence.Client/Clients/Interfaces/Refit/IRefitSetpointClient.cs
+++ b/DD.Persistence.Client/Clients/Interfaces/Refit/IRefitSetpointClient.cs
@@ -1,4 +1,5 @@
using DD.Persistence.Models;
+using DD.Persistence.Models.Common;
using Refit;
using System.Text.Json;
diff --git a/DD.Persistence.Client/Clients/Interfaces/Refit/IRefitTechMessagesClient.cs b/DD.Persistence.Client/Clients/Interfaces/Refit/IRefitTechMessagesClient.cs
index 337911e..ef9496e 100644
--- a/DD.Persistence.Client/Clients/Interfaces/Refit/IRefitTechMessagesClient.cs
+++ b/DD.Persistence.Client/Clients/Interfaces/Refit/IRefitTechMessagesClient.cs
@@ -1,6 +1,7 @@
using DD.Persistence.Models;
using DD.Persistence.Models.Requests;
using Refit;
+using DD.Persistence.Models.Common;
namespace DD.Persistence.Client.Clients.Interfaces.Refit
{
diff --git a/DD.Persistence.Client/Clients/Interfaces/Refit/IRefitTimeSeriesClient.cs b/DD.Persistence.Client/Clients/Interfaces/Refit/IRefitTimeSeriesClient.cs
deleted file mode 100644
index 832cfde..0000000
--- a/DD.Persistence.Client/Clients/Interfaces/Refit/IRefitTimeSeriesClient.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using DD.Persistence.Models;
-using Refit;
-
-namespace DD.Persistence.Client.Clients.Interfaces.Refit;
-public interface IRefitTimeSeriesClient : IRefitClient, IDisposable
- where TDto : class, ITimeSeriesAbstractDto
-{
- private const string BaseRoute = "/api/dataSaub";
-
- [Post($"{BaseRoute}")]
- Task> AddRange(IEnumerable dtos, CancellationToken token);
-
- [Get($"{BaseRoute}")]
- Task>> Get(DateTimeOffset dateBegin, DateTimeOffset dateEnd, CancellationToken token);
-
- [Get($"{BaseRoute}/resampled")]
- Task>> GetResampledData(DateTimeOffset dateBegin, double intervalSec = 600d, int approxPointsCount = 1024, CancellationToken token = default);
-
- [Get($"{BaseRoute}/datesRange")]
- Task> GetDatesRange(CancellationToken token);
-}
diff --git a/DD.Persistence.Client/Clients/Interfaces/Refit/IRefitTimestampedSetClient.cs b/DD.Persistence.Client/Clients/Interfaces/Refit/IRefitTimestampedSetClient.cs
deleted file mode 100644
index 6211d2d..0000000
--- a/DD.Persistence.Client/Clients/Interfaces/Refit/IRefitTimestampedSetClient.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using DD.Persistence.Models;
-using Refit;
-
-namespace DD.Persistence.Client.Clients.Interfaces.Refit;
-
-public interface IRefitTimestampedSetClient : IRefitClient, IDisposable
-{
- private const string baseUrl = "/api/TimestampedSet/{idDiscriminator}";
-
- [Post(baseUrl)]
- Task> AddRange(Guid idDiscriminator, IEnumerable sets, CancellationToken token);
-
- [Get(baseUrl)]
- Task>> Get(Guid idDiscriminator, [Query] DateTimeOffset? geTimestamp, [Query] IEnumerable? columnNames, int skip, int take, CancellationToken token);
-
- [Get($"{baseUrl}/last")]
- Task>> GetLast(Guid idDiscriminator, [Query] IEnumerable? columnNames, int take, CancellationToken token);
-
- [Get($"{baseUrl}/count")]
- Task> Count(Guid idDiscriminator, CancellationToken token);
-
- [Get($"{baseUrl}/datesRange")]
- Task> GetDatesRange(Guid idDiscriminator, CancellationToken token);
-}
diff --git a/DD.Persistence.Client/Clients/Interfaces/Refit/IRefitTimestampedValuesClient.cs b/DD.Persistence.Client/Clients/Interfaces/Refit/IRefitTimestampedValuesClient.cs
new file mode 100644
index 0000000..bd94136
--- /dev/null
+++ b/DD.Persistence.Client/Clients/Interfaces/Refit/IRefitTimestampedValuesClient.cs
@@ -0,0 +1,61 @@
+using DD.Persistence.Models;
+using DD.Persistence.Models.Common;
+using Refit;
+
+namespace DD.Persistence.Client.Clients.Interfaces.Refit;
+
+///
+/// Refit интерфейс для TimestampedValuesController
+///
+public interface IRefitTimestampedValuesClient : IRefitClient, IDisposable
+{
+ private const string baseUrl = "/api/TimestampedValues/{discriminatorId}";
+
+ ///
+ /// Записать новые данные
+ ///
+ [Post(baseUrl)]
+ Task> AddRange(Guid discriminatorId, IEnumerable dtos, CancellationToken token);
+
+ ///
+ /// Получение данных с фильтрацией
+ ///
+ [Get(baseUrl)]
+ Task>> Get(Guid discriminatorId, DateTimeOffset? timestampBegin, [Query(CollectionFormat.Multi)] IEnumerable? columnNames, int skip, int take, CancellationToken token);
+
+ ///
+ /// Получить данные, начиная с заданной отметки времени
+ ///
+ [Get($"{baseUrl}/gtdate")]
+ Task>> GetGtDate(Guid discriminatorId, DateTimeOffset timestampBegin, CancellationToken token);
+
+ ///
+ /// Получить данные c начала
+ ///
+ [Get($"{baseUrl}/first")]
+ Task>> GetFirst(Guid discriminatorId, int take, CancellationToken token);
+
+ ///
+ /// Получить данные c конца
+ ///
+ [Get($"{baseUrl}/last")]
+ Task>> GetLast(Guid discriminatorId, int take, CancellationToken token);
+
+ ///
+ /// Получить список объектов с прореживанием, удовлетворяющий диапазону временных отметок
+ ///
+ [Get($"{baseUrl}/resampled")]
+ Task>> GetResampledData(Guid discriminatorId, DateTimeOffset timestampBegin, double intervalSec = 600d, int approxPointsCount = 1024, CancellationToken token = default);
+
+ ///
+ /// Получить количество записей по указанному набору в БД. Для пагинации
+ ///
+ [Get($"{baseUrl}/count")]
+ Task> Count(Guid discriminatorId, CancellationToken token);
+
+ ///
+ /// Получить диапазон дат, в пределах которых хранятся даные
+ ///
+ [Get($"{baseUrl}/datesRange")]
+ Task> GetDatesRange(Guid discriminatorId, CancellationToken token);
+}
diff --git a/DD.Persistence.Client/Clients/Interfaces/Refit/IRefitWitsDataClient.cs b/DD.Persistence.Client/Clients/Interfaces/Refit/IRefitWitsDataClient.cs
index dcf2021..233083a 100644
--- a/DD.Persistence.Client/Clients/Interfaces/Refit/IRefitWitsDataClient.cs
+++ b/DD.Persistence.Client/Clients/Interfaces/Refit/IRefitWitsDataClient.cs
@@ -1,5 +1,6 @@
using DD.Persistence.Models;
using Refit;
+using DD.Persistence.Models.Common;
namespace DD.Persistence.Client.Clients.Interfaces.Refit;
public interface IRefitWitsDataClient : IRefitClient, IDisposable
diff --git a/DD.Persistence.Client/Clients/SetpointClient.cs b/DD.Persistence.Client/Clients/SetpointClient.cs
index 0e8df6a..dfb5026 100644
--- a/DD.Persistence.Client/Clients/SetpointClient.cs
+++ b/DD.Persistence.Client/Clients/SetpointClient.cs
@@ -1,4 +1,4 @@
-using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Logging;
using DD.Persistence.Client.Clients.Base;
using DD.Persistence.Client.Clients.Interfaces;
using DD.Persistence.Client.Clients.Interfaces.Refit;
@@ -6,6 +6,7 @@ using DD.Persistence.Models;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Globalization;
+using DD.Persistence.Models.Common;
namespace DD.Persistence.Client.Clients;
diff --git a/DD.Persistence.Client/Clients/TechMessagesClient.cs b/DD.Persistence.Client/Clients/TechMessagesClient.cs
index e23c961..681e275 100644
--- a/DD.Persistence.Client/Clients/TechMessagesClient.cs
+++ b/DD.Persistence.Client/Clients/TechMessagesClient.cs
@@ -4,6 +4,7 @@ using DD.Persistence.Client.Clients.Interfaces;
using DD.Persistence.Client.Clients.Interfaces.Refit;
using DD.Persistence.Models;
using DD.Persistence.Models.Requests;
+using DD.Persistence.Models.Common;
namespace DD.Persistence.Client.Clients;
diff --git a/DD.Persistence.Client/Clients/TimeSeriesClient.cs b/DD.Persistence.Client/Clients/TimeSeriesClient.cs
deleted file mode 100644
index c75ec81..0000000
--- a/DD.Persistence.Client/Clients/TimeSeriesClient.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using Microsoft.Extensions.Logging;
-using DD.Persistence.Client.Clients.Base;
-using DD.Persistence.Client.Clients.Interfaces;
-using DD.Persistence.Client.Clients.Interfaces.Refit;
-using DD.Persistence.Models;
-
-namespace DD.Persistence.Client.Clients;
-public class TimeSeriesClient : BaseClient, ITimeSeriesClient where TDto : class, ITimeSeriesAbstractDto
-{
- private readonly IRefitTimeSeriesClient timeSeriesClient;
-
- public TimeSeriesClient(IRefitClientFactory> refitTechMessagesClientFactory, ILogger> logger) : base(logger)
- {
- this.timeSeriesClient = refitTechMessagesClientFactory.Create();
- }
-
- public async Task AddRange(IEnumerable dtos, CancellationToken token)
- {
- var result = await ExecutePostResponse(
- async () => await timeSeriesClient.AddRange(dtos, token), token);
-
- return result;
- }
-
- public async Task> Get(DateTimeOffset dateBegin, DateTimeOffset dateEnd, CancellationToken token)
- {
- var result = await ExecuteGetResponse(
- async () => await timeSeriesClient.Get(dateBegin, dateEnd, token), token);
-
- return result!;
- }
-
- public async Task> GetResampledData(DateTimeOffset dateBegin, double intervalSec = 600d, int approxPointsCount = 1024, CancellationToken token = default)
- {
- var result = await ExecuteGetResponse(
- async () => await timeSeriesClient.GetResampledData(dateBegin, intervalSec, approxPointsCount, token), token);
-
- return result!;
- }
-
- public async Task GetDatesRange(CancellationToken token)
- {
- var result = await ExecuteGetResponse(
- async () => await timeSeriesClient.GetDatesRange(token), token);
-
- return result;
- }
-
- public void Dispose()
- {
- timeSeriesClient.Dispose();
-
- GC.SuppressFinalize(this);
- }
-}
diff --git a/DD.Persistence.Client/Clients/TimestampedSetClient.cs b/DD.Persistence.Client/Clients/TimestampedSetClient.cs
deleted file mode 100644
index 6295d02..0000000
--- a/DD.Persistence.Client/Clients/TimestampedSetClient.cs
+++ /dev/null
@@ -1,92 +0,0 @@
-using Microsoft.Extensions.Logging;
-using DD.Persistence.Client.Clients.Base;
-using DD.Persistence.Client.Clients.Interfaces;
-using DD.Persistence.Client.Clients.Interfaces.Refit;
-using DD.Persistence.Models;
-using static System.Runtime.InteropServices.JavaScript.JSType;
-using System.Runtime.CompilerServices;
-using System.Text.Json;
-using System.Reflection;
-using System.Collections.Concurrent;
-
-namespace DD.Persistence.Client.Clients;
-public class TimestampedSetClient : BaseClient, ITimestampedSetClient
-{
- private readonly IRefitTimestampedSetClient refitTimestampedSetClient;
- private readonly ConcurrentDictionary mapperCache = new();
- public TimestampedSetClient(IRefitClientFactory refitTimestampedSetClientFactory, ILogger logger) : base(logger)
- {
- this.refitTimestampedSetClient = refitTimestampedSetClientFactory.Create();
- }
-
- public async Task AddRange(Guid idDiscriminator, IEnumerable sets, CancellationToken token)
- {
- var result = await ExecutePostResponse(
- async () => await refitTimestampedSetClient.AddRange(idDiscriminator, sets, token), token);
-
- return result;
- }
-
- public async Task> Get(Guid idDiscriminator, DateTimeOffset? geTimestamp, IEnumerable? columnNames, int skip, int take, CancellationToken token)
- {
- var result = await ExecuteGetResponse(
- async () => await refitTimestampedSetClient.Get(idDiscriminator, geTimestamp, columnNames, skip, take, token), token);
-
- return result!;
- }
-
- public async Task> GetLast(Guid idDiscriminator, IEnumerable? columnNames, int take, CancellationToken token)
- {
- var result = await ExecuteGetResponse(
- async () => await refitTimestampedSetClient.GetLast(idDiscriminator, columnNames, take, token), token);
-
- return result!;
- }
-
- public async Task Count(Guid idDiscriminator, CancellationToken token)
- {
- var result = await ExecuteGetResponse(
- async () => await refitTimestampedSetClient.Count(idDiscriminator, token), token);
-
- return result;
- }
-
- public async Task GetDatesRange(Guid idDiscriminator, CancellationToken token)
- {
- var result = await ExecuteGetResponse(
- async () => await refitTimestampedSetClient.GetDatesRange(idDiscriminator, token), token);
-
- return result;
- }
-
- public async Task> Get(Guid idDiscriminator, DateTimeOffset? geTimestamp, IEnumerable? columnNames, int skip, int take, CancellationToken token)
- {
- var data = await Get(idDiscriminator, geTimestamp, columnNames, skip, take, token);
- var mapper = GetMapper(idDiscriminator);
-
- return data.Select(mapper.DeserializeTimeStampedData);
- }
-
-
-
- public async Task> GetLast(Guid idDiscriminator, IEnumerable? columnNames, int take, CancellationToken token)
- {
- var data = await GetLast(idDiscriminator, columnNames, take, token);
- var mapper = GetMapper(idDiscriminator);
-
- return data.Select(mapper.DeserializeTimeStampedData);
- }
-
- private TimestampedSetMapper GetMapper(Guid idDiscriminator)
- {
- return (TimestampedSetMapper)mapperCache.GetOrAdd(idDiscriminator, name => new TimestampedSetMapper(idDiscriminator));
- }
- public void Dispose()
- {
- refitTimestampedSetClient.Dispose();
-
- GC.SuppressFinalize(this);
- }
-
-
-}
diff --git a/DD.Persistence.Client/Clients/TimestampedValuesClient.cs b/DD.Persistence.Client/Clients/TimestampedValuesClient.cs
new file mode 100644
index 0000000..bafead6
--- /dev/null
+++ b/DD.Persistence.Client/Clients/TimestampedValuesClient.cs
@@ -0,0 +1,127 @@
+using DD.Persistence.Client.Clients.Base;
+using DD.Persistence.Client.Clients.Interfaces;
+using DD.Persistence.Client.Clients.Interfaces.Refit;
+using DD.Persistence.Models;
+using DD.Persistence.Models.Common;
+using Microsoft.Extensions.Logging;
+using System.Collections.Concurrent;
+
+namespace DD.Persistence.Client.Clients;
+
+///
+public class TimestampedValuesClient : BaseClient, ITimestampedValuesClient
+{
+ private readonly IRefitTimestampedValuesClient refitTimestampedSetClient;
+
+ ///
+ public TimestampedValuesClient(IRefitClientFactory refitTimestampedSetClientFactory, ILogger logger) : base(logger)
+ {
+ this.refitTimestampedSetClient = refitTimestampedSetClientFactory.Create();
+ }
+
+ ///
+ private readonly ConcurrentDictionary mapperCache = new();
+
+ ///
+ public async Task AddRange(Guid discriminatorId, IEnumerable sets, CancellationToken token)
+ {
+ var result = await ExecutePostResponse(
+ async () => await refitTimestampedSetClient.AddRange(discriminatorId, sets, token), token);
+
+ return result;
+ }
+
+ ///
+ public async Task> Get(Guid discriminatorId, DateTimeOffset? geTimestamp, IEnumerable? columnNames, int skip, int take, CancellationToken token)
+ {
+ var result = await ExecuteGetResponse(
+ async () => await refitTimestampedSetClient.Get(discriminatorId, geTimestamp, columnNames, skip, take, token), token);
+ return result;
+ }
+
+ ///
+ public async Task> GetGtDate(Guid discriminatorId, DateTimeOffset timestampBegin, CancellationToken token)
+ {
+ var result = await ExecuteGetResponse(
+ async () => await refitTimestampedSetClient.GetGtDate(discriminatorId, timestampBegin, token), token);
+
+ return result;
+ }
+
+ ///
+ public async Task> GetFirst(Guid discriminatorId, int take, CancellationToken token)
+ {
+ var result = await ExecuteGetResponse(
+ async () => await refitTimestampedSetClient.GetFirst(discriminatorId, take, token), token);
+
+ return result;
+ }
+
+ ///
+ public async Task> GetLast(Guid discriminatorId, int take, CancellationToken token)
+ {
+ var result = await ExecuteGetResponse(
+ async () => await refitTimestampedSetClient.GetLast(discriminatorId, take, token), token);
+
+ return result;
+ }
+
+ ///
+ public async Task> GetResampledData(Guid discriminatorId, DateTimeOffset dateBegin, double intervalSec = 600, int approxPointsCount = 1024, CancellationToken token = default)
+ {
+ var result = await ExecuteGetResponse(
+ async () => await refitTimestampedSetClient.GetResampledData(discriminatorId, dateBegin, intervalSec, approxPointsCount, token), token);
+
+ return result;
+ }
+
+ ///
+ public async Task Count(Guid discriminatorId, CancellationToken token)
+ {
+ var result = await ExecuteGetResponse(
+ async () => await refitTimestampedSetClient.Count(discriminatorId, token), token);
+
+ return result;
+ }
+
+ ///
+ public async Task GetDatesRange(Guid discriminatorId, CancellationToken token)
+ {
+ var result = await ExecuteGetResponse(
+ async () => await refitTimestampedSetClient.GetDatesRange(discriminatorId, token), token);
+
+ return result;
+ }
+
+ ///
+ public async Task> Get(Guid idDiscriminator, DateTimeOffset? geTimestamp, IEnumerable? columnNames, int skip, int take, CancellationToken token)
+ {
+ var data = await Get(idDiscriminator, geTimestamp, columnNames, skip, take, token);
+ var mapper = GetMapper(idDiscriminator);
+
+ return data.Select(mapper.DeserializeTimeStampedData);
+ }
+
+ ///
+ public async Task> GetLast(Guid idDiscriminator, int take, CancellationToken token)
+ {
+ var data = await GetLast(idDiscriminator, take, token);
+ var mapper = GetMapper(idDiscriminator);
+
+ return data.Select(mapper.DeserializeTimeStampedData);
+ }
+
+ ///
+ private TimestampedSetMapper GetMapper(Guid idDiscriminator)
+ {
+ return (TimestampedSetMapper)mapperCache.GetOrAdd(idDiscriminator, name => new TimestampedSetMapper(idDiscriminator));
+ }
+
+ ///
+ public void Dispose()
+ {
+ refitTimestampedSetClient.Dispose();
+
+ GC.SuppressFinalize(this);
+ }
+}
diff --git a/DD.Persistence.Client/Clients/WitsDataClient.cs b/DD.Persistence.Client/Clients/WitsDataClient.cs
index e2703dc..d47f771 100644
--- a/DD.Persistence.Client/Clients/WitsDataClient.cs
+++ b/DD.Persistence.Client/Clients/WitsDataClient.cs
@@ -3,6 +3,7 @@ using DD.Persistence.Client.Clients.Base;
using DD.Persistence.Client.Clients.Interfaces;
using DD.Persistence.Client.Clients.Interfaces.Refit;
using DD.Persistence.Models;
+using DD.Persistence.Models.Common;
namespace DD.Persistence.Client.Clients;
public class WitsDataClient : BaseClient, IWitsDataClient
diff --git a/DD.Persistence.Client/DependencyInjection.cs b/DD.Persistence.Client/DependencyInjection.cs
index e5c7c29..89f65cf 100644
--- a/DD.Persistence.Client/DependencyInjection.cs
+++ b/DD.Persistence.Client/DependencyInjection.cs
@@ -22,8 +22,7 @@ public static class DependencyInjection
services.AddTransient();
services.AddTransient();
services.AddTransient();
- services.AddTransient, TimeSeriesClient>();
- services.AddTransient();
+ services.AddTransient();
services.AddTransient();
services.AddSingleton(provider =>
diff --git a/DD.Persistence.Client/Readme.md b/DD.Persistence.Client/Readme.md
index 1e09e2f..6bdae87 100644
--- a/DD.Persistence.Client/Readme.md
+++ b/DD.Persistence.Client/Readme.md
@@ -11,8 +11,7 @@ Persistence сервисом посредством обращения к кон
## Список предоставляемых клиентов
- `ISetpointClient` - Клиент для работы с уставками
- `ITechMessagesClient` - Клиент для работы с технологическими сообщениями
-- `ITimeSeriesClient` - Клиент для работы с временными данными
-- `ITimestampedSetClient` - Клиент для работы с данными с отметкой времени
+- `ITimestampedValuesClient` - Клиент для работы с наборами данных, имеющими отметку времени
- `IChangeLogClient` - Клиент для работы с записями ChangeLog
- `IWitsDataClient` - Клиент для работы с параметрами Wits
- `IDataSourceSystemClient` - Клиент для работы с системами
diff --git a/DD.Persistence.Client/TimestampedSetMapper.cs b/DD.Persistence.Client/TimestampedSetMapper.cs
index 521fc18..cf7463a 100644
--- a/DD.Persistence.Client/TimestampedSetMapper.cs
+++ b/DD.Persistence.Client/TimestampedSetMapper.cs
@@ -8,7 +8,7 @@ namespace DD.Persistence.Client;
internal abstract class TimestampedSetMapperBase
{
- public abstract object Map(TimestampedSetDto data);
+ public abstract object Map(TimestampedValuesDto data);
}
internal class TimestampedSetMapper : TimestampedSetMapperBase
@@ -22,12 +22,12 @@ internal class TimestampedSetMapper : TimestampedSetMapperBase
IdDiscriminator = idDiscriminator;
}
- public override object Map(TimestampedSetDto data)
+ public override object Map(TimestampedValuesDto data)
{
return DeserializeTimeStampedData(data)!;
}
- public T DeserializeTimeStampedData(TimestampedSetDto data)
+ public T DeserializeTimeStampedData(TimestampedValuesDto data)
{
if (entityType.IsValueType)
@@ -36,10 +36,10 @@ internal class TimestampedSetMapper : TimestampedSetMapperBase
return MapClass(data);
}
- private T MapClass(TimestampedSetDto data)
+ private T MapClass(TimestampedValuesDto data)
{
var entity = (T)RuntimeHelpers.GetUninitializedObject(typeof(T));
- foreach (var (propertyName, value) in data.Set)
+ foreach (var (propertyName, value) in data.Values)
{
if (value is JsonElement jsonElement)
SetPropertyValueFromJson(ref entity, propertyName, jsonElement);
@@ -48,11 +48,11 @@ internal class TimestampedSetMapper : TimestampedSetMapperBase
return entity;
}
- private T MapStruct(TimestampedSetDto data)
+ private T MapStruct(TimestampedValuesDto data)
{
var entity = Activator.CreateInstance();
object boxedEntity = entity!;
- foreach (var (propertyName, value) in data.Set)
+ foreach (var (propertyName, value) in data.Values)
{
if (value is JsonElement jsonElement)
SetPropertyValueForStructFromJson(ref boxedEntity, propertyName, jsonElement);
diff --git a/DD.Persistence.Database.Postgres/Migrations/20241220062251_Init.Designer.cs b/DD.Persistence.Database.Postgres/Migrations/20250122111321_Init.Designer.cs
similarity index 66%
rename from DD.Persistence.Database.Postgres/Migrations/20241220062251_Init.Designer.cs
rename to DD.Persistence.Database.Postgres/Migrations/20250122111321_Init.Designer.cs
index 02a25ce..a3678d6 100644
--- a/DD.Persistence.Database.Postgres/Migrations/20241220062251_Init.Designer.cs
+++ b/DD.Persistence.Database.Postgres/Migrations/20250122111321_Init.Designer.cs
@@ -1,5 +1,6 @@
//
using System;
+using System.Text.Json;
using DD.Persistence.Database.Model;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
@@ -12,7 +13,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace DD.Persistence.Database.Postgres.Migrations
{
[DbContext(typeof(PersistencePostgresContext))]
- [Migration("20241220062251_Init")]
+ [Migration("20250122111321_Init")]
partial class Init
{
///
@@ -20,11 +21,28 @@ namespace DD.Persistence.Database.Postgres.Migrations
{
#pragma warning disable 612, 618
modelBuilder
- .HasAnnotation("ProductVersion", "8.0.10")
+ .HasAnnotation("ProductVersion", "9.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+ modelBuilder.Entity("DD.Persistence.Database.Entity.DataScheme", b =>
+ {
+ b.Property("DiscriminatorId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid")
+ .HasComment("Идентификатор схемы данных");
+
+ b.Property("PropNames")
+ .IsRequired()
+ .HasColumnType("jsonb")
+ .HasComment("Наименования полей в порядке индексации");
+
+ b.HasKey("DiscriminatorId");
+
+ b.ToTable("DataSchemes");
+ });
+
modelBuilder.Entity("DD.Persistence.Database.Entity.DataSourceSystem", b =>
{
b.Property("SystemId")
@@ -105,27 +123,24 @@ namespace DD.Persistence.Database.Postgres.Migrations
b.ToTable("TechMessage");
});
- modelBuilder.Entity("DD.Persistence.Database.Entity.TimestampedSet", b =>
+ modelBuilder.Entity("DD.Persistence.Database.Entity.TimestampedValues", b =>
{
- b.Property("IdDiscriminator")
+ b.Property("DiscriminatorId")
.HasColumnType("uuid")
- .HasComment("Дискриминатор ссылка на тип сохраняемых данных");
+ .HasComment("Дискриминатор системы");
b.Property("Timestamp")
.HasColumnType("timestamp with time zone")
- .HasComment("Отметка времени, строго в UTC");
+ .HasComment("Временная отметка");
- b.Property("Set")
+ b.Property("Values")
.IsRequired()
.HasColumnType("jsonb")
- .HasComment("Набор сохраняемых данных");
+ .HasComment("Данные");
- b.HasKey("IdDiscriminator", "Timestamp");
+ b.HasKey("DiscriminatorId", "Timestamp");
- b.ToTable("TimestampedSets", t =>
- {
- t.HasComment("Общая таблица данных временных рядов");
- });
+ b.ToTable("TimestampedValues");
});
modelBuilder.Entity("DD.Persistence.Database.Model.ChangeLog", b =>
@@ -181,96 +196,13 @@ namespace DD.Persistence.Database.Postgres.Migrations
b.ToTable("ChangeLog");
});
- modelBuilder.Entity("DD.Persistence.Database.Model.DataSaub", b =>
- {
- b.Property("Date")
- .HasColumnType("timestamp with time zone")
- .HasColumnName("date");
-
- b.Property("AxialLoad")
- .HasColumnType("double precision")
- .HasColumnName("axialLoad");
-
- b.Property("BitDepth")
- .HasColumnType("double precision")
- .HasColumnName("bitDepth");
-
- b.Property("BlockPosition")
- .HasColumnType("double precision")
- .HasColumnName("blockPosition");
-
- b.Property("BlockSpeed")
- .HasColumnType("double precision")
- .HasColumnName("blockSpeed");
-
- b.Property("Flow")
- .HasColumnType("double precision")
- .HasColumnName("flow");
-
- b.Property("HookWeight")
- .HasColumnType("double precision")
- .HasColumnName("hookWeight");
-
- b.Property("IdFeedRegulator")
- .HasColumnType("integer")
- .HasColumnName("idFeedRegulator");
-
- b.Property("Mode")
- .HasColumnType("integer")
- .HasColumnName("mode");
-
- b.Property("Mse")
- .HasColumnType("double precision")
- .HasColumnName("mse");
-
- b.Property("MseState")
- .HasColumnType("smallint")
- .HasColumnName("mseState");
-
- b.Property("Pressure")
- .HasColumnType("double precision")
- .HasColumnName("pressure");
-
- b.Property("Pump0Flow")
- .HasColumnType("double precision")
- .HasColumnName("pump0Flow");
-
- b.Property("Pump1Flow")
- .HasColumnType("double precision")
- .HasColumnName("pump1Flow");
-
- b.Property("Pump2Flow")
- .HasColumnType("double precision")
- .HasColumnName("pump2Flow");
-
- b.Property("RotorSpeed")
- .HasColumnType("double precision")
- .HasColumnName("rotorSpeed");
-
- b.Property("RotorTorque")
- .HasColumnType("double precision")
- .HasColumnName("rotorTorque");
-
- b.Property("User")
- .HasColumnType("text")
- .HasColumnName("user");
-
- b.Property("WellDepth")
- .HasColumnType("double precision")
- .HasColumnName("wellDepth");
-
- b.HasKey("Date");
-
- b.ToTable("DataSaub");
- });
-
modelBuilder.Entity("DD.Persistence.Database.Model.Setpoint", b =>
{
b.Property("Key")
.HasColumnType("uuid")
.HasComment("Ключ");
- b.Property("Created")
+ b.Property("Timestamp")
.HasColumnType("timestamp with time zone")
.HasComment("Дата создания уставки");
@@ -278,12 +210,11 @@ namespace DD.Persistence.Database.Postgres.Migrations
.HasColumnType("uuid")
.HasComment("Id автора последнего изменения");
- b.Property