Привести дискриминатор системы к типу Guid
This commit is contained in:
parent
de2a7cfe04
commit
1e8d478b68
@ -22,7 +22,7 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
|||||||
[HttpPost("{idDiscriminator}")]
|
[HttpPost("{idDiscriminator}")]
|
||||||
[ProducesResponseType(typeof(int), (int)HttpStatusCode.Created)]
|
[ProducesResponseType(typeof(int), (int)HttpStatusCode.Created)]
|
||||||
public async Task<IActionResult> Add(
|
public async Task<IActionResult> Add(
|
||||||
[FromRoute] int idDiscriminator,
|
[FromRoute] Guid idDiscriminator,
|
||||||
[FromBody] DataWithWellDepthAndSectionDto dto,
|
[FromBody] DataWithWellDepthAndSectionDto dto,
|
||||||
CancellationToken token)
|
CancellationToken token)
|
||||||
{
|
{
|
||||||
@ -35,7 +35,7 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
|||||||
[HttpPost("range/{idDiscriminator}")]
|
[HttpPost("range/{idDiscriminator}")]
|
||||||
[ProducesResponseType(typeof(int), (int)HttpStatusCode.Created)]
|
[ProducesResponseType(typeof(int), (int)HttpStatusCode.Created)]
|
||||||
public async Task<IActionResult> AddRange(
|
public async Task<IActionResult> AddRange(
|
||||||
[FromRoute] int idDiscriminator,
|
[FromRoute] Guid idDiscriminator,
|
||||||
[FromBody] IEnumerable<DataWithWellDepthAndSectionDto> dtos,
|
[FromBody] IEnumerable<DataWithWellDepthAndSectionDto> dtos,
|
||||||
CancellationToken token)
|
CancellationToken token)
|
||||||
{
|
{
|
||||||
@ -68,7 +68,7 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
|||||||
[HttpPost("replace/{idDiscriminator}")]
|
[HttpPost("replace/{idDiscriminator}")]
|
||||||
[ProducesResponseType(typeof(int), (int)HttpStatusCode.OK)]
|
[ProducesResponseType(typeof(int), (int)HttpStatusCode.OK)]
|
||||||
public async Task<IActionResult> ClearAndAddRange(
|
public async Task<IActionResult> ClearAndAddRange(
|
||||||
[FromRoute] int idDiscriminator,
|
[FromRoute] Guid idDiscriminator,
|
||||||
[FromBody] IEnumerable<DataWithWellDepthAndSectionDto> dtos,
|
[FromBody] IEnumerable<DataWithWellDepthAndSectionDto> dtos,
|
||||||
CancellationToken token)
|
CancellationToken token)
|
||||||
{
|
{
|
||||||
@ -104,7 +104,7 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
|||||||
[HttpGet("{idDiscriminator}")]
|
[HttpGet("{idDiscriminator}")]
|
||||||
[ProducesResponseType(typeof(PaginationContainer<DataWithWellDepthAndSectionDto>), (int)HttpStatusCode.OK)]
|
[ProducesResponseType(typeof(PaginationContainer<DataWithWellDepthAndSectionDto>), (int)HttpStatusCode.OK)]
|
||||||
public async Task<IActionResult> GetCurrent(
|
public async Task<IActionResult> GetCurrent(
|
||||||
[FromRoute] int idDiscriminator,
|
[FromRoute] Guid idDiscriminator,
|
||||||
[FromQuery] SectionPartRequest filterRequest,
|
[FromQuery] SectionPartRequest filterRequest,
|
||||||
[FromQuery] PaginationRequest paginationRequest,
|
[FromQuery] PaginationRequest paginationRequest,
|
||||||
CancellationToken token)
|
CancellationToken token)
|
||||||
@ -118,7 +118,7 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
|||||||
[HttpGet("moment/{idDiscriminator}")]
|
[HttpGet("moment/{idDiscriminator}")]
|
||||||
[ProducesResponseType(typeof(PaginationContainer<DataWithWellDepthAndSectionDto>), (int)HttpStatusCode.OK)]
|
[ProducesResponseType(typeof(PaginationContainer<DataWithWellDepthAndSectionDto>), (int)HttpStatusCode.OK)]
|
||||||
public async Task<IActionResult> GetByDate(
|
public async Task<IActionResult> GetByDate(
|
||||||
[FromRoute] int idDiscriminator,
|
[FromRoute] Guid idDiscriminator,
|
||||||
DateTimeOffset moment,
|
DateTimeOffset moment,
|
||||||
[FromQuery] SectionPartRequest filterRequest,
|
[FromQuery] SectionPartRequest filterRequest,
|
||||||
[FromQuery] PaginationRequest paginationRequest,
|
[FromQuery] PaginationRequest paginationRequest,
|
||||||
@ -133,7 +133,7 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
|||||||
[ProducesResponseType(typeof(IEnumerable<ChangeLogDto>), (int)HttpStatusCode.OK)]
|
[ProducesResponseType(typeof(IEnumerable<ChangeLogDto>), (int)HttpStatusCode.OK)]
|
||||||
[ProducesResponseType((int)HttpStatusCode.NoContent)]
|
[ProducesResponseType((int)HttpStatusCode.NoContent)]
|
||||||
public async Task<IActionResult> GetChangeLogForDate(
|
public async Task<IActionResult> GetChangeLogForDate(
|
||||||
[FromRoute] int idDiscriminator,
|
[FromRoute] Guid idDiscriminator,
|
||||||
DateTimeOffset dateBegin,
|
DateTimeOffset dateBegin,
|
||||||
DateTimeOffset dateEnd,
|
DateTimeOffset dateEnd,
|
||||||
CancellationToken token)
|
CancellationToken token)
|
||||||
@ -146,7 +146,7 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
|||||||
[HttpGet("datesChange/{idDiscriminator}")]
|
[HttpGet("datesChange/{idDiscriminator}")]
|
||||||
[ProducesResponseType(typeof(IEnumerable<DateOnly>), (int)HttpStatusCode.OK)]
|
[ProducesResponseType(typeof(IEnumerable<DateOnly>), (int)HttpStatusCode.OK)]
|
||||||
[ProducesResponseType((int)HttpStatusCode.NoContent)]
|
[ProducesResponseType((int)HttpStatusCode.NoContent)]
|
||||||
public async Task<IActionResult> GetDatesChange([FromRoute] int idDiscriminator, CancellationToken token)
|
public async Task<IActionResult> GetDatesChange([FromRoute] Guid idDiscriminator, CancellationToken token)
|
||||||
{
|
{
|
||||||
var result = await repository.GetDatesChange(idDiscriminator, token);
|
var result = await repository.GetDatesChange(idDiscriminator, token);
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
|||||||
[HttpGet("part/{idDiscriminator}")]
|
[HttpGet("part/{idDiscriminator}")]
|
||||||
[ProducesResponseType(typeof(IEnumerable<DataWithWellDepthAndSectionDto>), (int)HttpStatusCode.OK)]
|
[ProducesResponseType(typeof(IEnumerable<DataWithWellDepthAndSectionDto>), (int)HttpStatusCode.OK)]
|
||||||
[ProducesResponseType((int)HttpStatusCode.NoContent)]
|
[ProducesResponseType((int)HttpStatusCode.NoContent)]
|
||||||
public async Task<ActionResult<IEnumerable<DataWithWellDepthAndSectionDto>>> GetPart([FromRoute] int idDiscriminator, DateTimeOffset dateBegin, int take = 86400, CancellationToken token = default)
|
public async Task<ActionResult<IEnumerable<DataWithWellDepthAndSectionDto>>> GetPart([FromRoute] Guid idDiscriminator, DateTimeOffset dateBegin, int take = 86400, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
var result = await repository.GetGtDate(idDiscriminator, dateBegin, token);
|
var result = await repository.GetGtDate(idDiscriminator, dateBegin, token);
|
||||||
|
|
||||||
@ -166,7 +166,7 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
|||||||
[HttpGet("datesRange/{idDiscriminator}")]
|
[HttpGet("datesRange/{idDiscriminator}")]
|
||||||
[ProducesResponseType(typeof(DatesRangeDto), (int)HttpStatusCode.OK)]
|
[ProducesResponseType(typeof(DatesRangeDto), (int)HttpStatusCode.OK)]
|
||||||
[ProducesResponseType((int)HttpStatusCode.NoContent)]
|
[ProducesResponseType((int)HttpStatusCode.NoContent)]
|
||||||
public async Task<ActionResult<DatesRangeDto>> GetDatesRangeAsync([FromRoute] int idDiscriminator, CancellationToken token)
|
public async Task<ActionResult<DatesRangeDto>> GetDatesRangeAsync([FromRoute] Guid idDiscriminator, CancellationToken token)
|
||||||
{
|
{
|
||||||
var result = await repository.GetDatesRange(idDiscriminator, token);
|
var result = await repository.GetDatesRange(idDiscriminator, token);
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ public class WitsDataController : ControllerBase, IWitsDataApi
|
|||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("{discriminatorId}/datesRange")]
|
[HttpGet("{discriminatorId}/datesRange")]
|
||||||
public async Task<ActionResult<DatesRangeDto>> GetDatesRangeAsync([FromRoute] int discriminatorId, CancellationToken token)
|
public async Task<ActionResult<DatesRangeDto>> GetDatesRangeAsync([FromRoute] Guid discriminatorId, CancellationToken token)
|
||||||
{
|
{
|
||||||
var result = await witsDataService.GetDatesRangeAsync(discriminatorId, token);
|
var result = await witsDataService.GetDatesRangeAsync(discriminatorId, token);
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ public class WitsDataController : ControllerBase, IWitsDataApi
|
|||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("{discriminatorId}/part")]
|
[HttpGet("{discriminatorId}/part")]
|
||||||
public async Task<ActionResult<IEnumerable<WitsDataDto>>> GetPart([FromRoute] int discriminatorId, [FromQuery] DateTimeOffset dateBegin, [FromQuery] int take, CancellationToken token)
|
public async Task<ActionResult<IEnumerable<WitsDataDto>>> GetPart([FromRoute] Guid discriminatorId, [FromQuery] DateTimeOffset dateBegin, [FromQuery] int take, CancellationToken token)
|
||||||
{
|
{
|
||||||
var result = await witsDataService.GetPart(discriminatorId, dateBegin, take, token);
|
var result = await witsDataService.GetPart(discriminatorId, dateBegin, take, token);
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ public class WitsDataController : ControllerBase, IWitsDataApi
|
|||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("{discriminatorId}/graph")]
|
[HttpGet("{discriminatorId}/graph")]
|
||||||
public async Task<ActionResult<IEnumerable<WitsDataDto>>> GetValuesForGraph([FromRoute] int discriminatorId,
|
public async Task<ActionResult<IEnumerable<WitsDataDto>>> GetValuesForGraph([FromRoute] Guid discriminatorId,
|
||||||
[FromQuery] DateTimeOffset dateFrom, [FromQuery] DateTimeOffset dateTo, [FromQuery] int approxPointsCount, CancellationToken token)
|
[FromQuery] DateTimeOffset dateFrom, [FromQuery] DateTimeOffset dateTo, [FromQuery] int approxPointsCount, CancellationToken token)
|
||||||
{
|
{
|
||||||
var result = await witsDataService.GetValuesForGraph(discriminatorId, dateFrom, dateTo, approxPointsCount, token);
|
var result = await witsDataService.GetValuesForGraph(discriminatorId, dateFrom, dateTo, approxPointsCount, token);
|
||||||
|
@ -18,7 +18,7 @@ public interface IChangeLogClient
|
|||||||
/// <param name="dtos"></param>
|
/// <param name="dtos"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[Post($"{BaseRoute}/replace/{{idDiscriminator}}")]
|
[Post($"{BaseRoute}/replace/{{idDiscriminator}}")]
|
||||||
Task<IApiResponse<int>> ClearAndAddRange(int idDiscriminator, IEnumerable<DataWithWellDepthAndSectionDto> dtos);
|
Task<IApiResponse<int>> ClearAndAddRange(Guid idDiscriminator, IEnumerable<DataWithWellDepthAndSectionDto> dtos);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получение актуальных данных на определенную дату (с пагинацией)
|
/// Получение актуальных данных на определенную дату (с пагинацией)
|
||||||
@ -30,7 +30,7 @@ public interface IChangeLogClient
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[Get($"{BaseRoute}/moment/{{idDiscriminator}}")]
|
[Get($"{BaseRoute}/moment/{{idDiscriminator}}")]
|
||||||
Task<IApiResponse<PaginationContainer<DataWithWellDepthAndSectionDto>>> GetByDate(
|
Task<IApiResponse<PaginationContainer<DataWithWellDepthAndSectionDto>>> GetByDate(
|
||||||
int idDiscriminator,
|
Guid idDiscriminator,
|
||||||
DateTimeOffset moment,
|
DateTimeOffset moment,
|
||||||
[Query] SectionPartRequest filterRequest,
|
[Query] SectionPartRequest filterRequest,
|
||||||
[Query] PaginationRequest paginationRequest);
|
[Query] PaginationRequest paginationRequest);
|
||||||
@ -43,7 +43,7 @@ public interface IChangeLogClient
|
|||||||
/// <param name="dateEnd"></param>
|
/// <param name="dateEnd"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[Get($"{BaseRoute}/history/{{idDiscriminator}}")]
|
[Get($"{BaseRoute}/history/{{idDiscriminator}}")]
|
||||||
Task<IApiResponse<IEnumerable<ChangeLogDto>>> GetChangeLogForInterval(int idDiscriminator, DateTimeOffset dateBegin, DateTimeOffset dateEnd);
|
Task<IApiResponse<IEnumerable<ChangeLogDto>>> GetChangeLogForInterval(Guid idDiscriminator, DateTimeOffset dateBegin, DateTimeOffset dateEnd);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Добавить одну запись
|
/// Добавить одну запись
|
||||||
@ -52,7 +52,7 @@ public interface IChangeLogClient
|
|||||||
/// <param name="dto"></param>
|
/// <param name="dto"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[Post($"{BaseRoute}/{{idDiscriminator}}")]
|
[Post($"{BaseRoute}/{{idDiscriminator}}")]
|
||||||
Task<IApiResponse<int>> Add(int idDiscriminator, DataWithWellDepthAndSectionDto dto);
|
Task<IApiResponse<int>> Add(Guid idDiscriminator, DataWithWellDepthAndSectionDto dto);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Добавить несколько записей
|
/// Добавить несколько записей
|
||||||
@ -61,7 +61,7 @@ public interface IChangeLogClient
|
|||||||
/// <param name="dtos"></param>
|
/// <param name="dtos"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[Post($"{BaseRoute}/range/{{idDiscriminator}}")]
|
[Post($"{BaseRoute}/range/{{idDiscriminator}}")]
|
||||||
Task<IApiResponse<int>> AddRange(int idDiscriminator, IEnumerable<DataWithWellDepthAndSectionDto> dtos);
|
Task<IApiResponse<int>> AddRange(Guid idDiscriminator, IEnumerable<DataWithWellDepthAndSectionDto> dtos);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Обновить одну запись
|
/// Обновить одну запись
|
||||||
@ -101,6 +101,6 @@ public interface IChangeLogClient
|
|||||||
/// <param name="idDiscriminator"></param>
|
/// <param name="idDiscriminator"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[Get($"{BaseRoute}/datesRange/{{idDiscriminator}}")]
|
[Get($"{BaseRoute}/datesRange/{{idDiscriminator}}")]
|
||||||
Task<IApiResponse<DatesRangeDto?>> GetDatesRange(int idDiscriminator);
|
Task<IApiResponse<DatesRangeDto?>> GetDatesRange(Guid idDiscriminator);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,14 +8,14 @@ public interface IWitsDataClient
|
|||||||
private const string BaseRoute = "/api/witsData";
|
private const string BaseRoute = "/api/witsData";
|
||||||
|
|
||||||
[Get($"{BaseRoute}/{{discriminatorId}}/graph")]
|
[Get($"{BaseRoute}/{{discriminatorId}}/graph")]
|
||||||
Task<IApiResponse<IEnumerable<WitsDataDto>>> GetValuesForGraph(int discriminatorId, [Query] DateTimeOffset dateFrom, [Query] DateTimeOffset dateTo, [Query] int approxPointsCount, CancellationToken token);
|
Task<IApiResponse<IEnumerable<WitsDataDto>>> GetValuesForGraph(Guid discriminatorId, [Query] DateTimeOffset dateFrom, [Query] DateTimeOffset dateTo, [Query] int approxPointsCount, CancellationToken token);
|
||||||
|
|
||||||
[Post($"{BaseRoute}/")]
|
[Post($"{BaseRoute}/")]
|
||||||
Task<IApiResponse<int>> AddRange(IEnumerable<WitsDataDto> dtos, CancellationToken token);
|
Task<IApiResponse<int>> AddRange(IEnumerable<WitsDataDto> dtos, CancellationToken token);
|
||||||
|
|
||||||
[Get($"{BaseRoute}/{{discriminatorId}}/part")]
|
[Get($"{BaseRoute}/{{discriminatorId}}/part")]
|
||||||
Task<IApiResponse<IEnumerable<WitsDataDto>>> GetPart(int discriminatorId, [Query] DateTimeOffset dateBegin, [Query] int take = 24 * 60 * 60, CancellationToken token = default);
|
Task<IApiResponse<IEnumerable<WitsDataDto>>> GetPart(Guid discriminatorId, [Query] DateTimeOffset dateBegin, [Query] int take = 24 * 60 * 60, CancellationToken token = default);
|
||||||
|
|
||||||
[Get($"{BaseRoute}/{{discriminatorId}}/datesRange")]
|
[Get($"{BaseRoute}/{{discriminatorId}}/datesRange")]
|
||||||
Task<IApiResponse<DatesRangeDto>> GetDatesRangeAsync(int discriminatorId, CancellationToken token);
|
Task<IApiResponse<DatesRangeDto>> GetDatesRangeAsync(Guid discriminatorId, CancellationToken token);
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ namespace Persistence.Database.Postgres.Migrations
|
|||||||
name: "ParameterData",
|
name: "ParameterData",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
DiscriminatorId = table.Column<int>(type: "integer", nullable: false, comment: "Дискриминатор системы"),
|
DiscriminatorId = table.Column<Guid>(type: "uuid", nullable: false, comment: "Дискриминатор системы"),
|
||||||
ParameterId = table.Column<int>(type: "integer", nullable: false, comment: "Id параметра"),
|
ParameterId = table.Column<int>(type: "integer", nullable: false, comment: "Id параметра"),
|
||||||
Timestamp = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "Временная отметка"),
|
Timestamp = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "Временная отметка"),
|
||||||
Value = table.Column<string>(type: "varchar(256)", nullable: false, comment: "Значение параметра в виде строки")
|
Value = table.Column<string>(type: "varchar(256)", nullable: false, comment: "Значение параметра в виде строки")
|
||||||
|
@ -15,7 +15,7 @@ public class ChangeLog : IChangeLog, IWithSectionPart
|
|||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
[Comment("Дискриминатор таблицы")]
|
[Comment("Дискриминатор таблицы")]
|
||||||
public int IdDiscriminator { get; set; }
|
public Guid IdDiscriminator { get; set; }
|
||||||
|
|
||||||
[Comment("Автор изменения")]
|
[Comment("Автор изменения")]
|
||||||
public Guid IdAuthor { get; set; }
|
public Guid IdAuthor { get; set; }
|
||||||
|
@ -39,7 +39,7 @@ public interface IChangeLog
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Дискриминатор таблицы
|
/// Дискриминатор таблицы
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int IdDiscriminator { get; set; }
|
public Guid IdDiscriminator { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Значение
|
/// Значение
|
||||||
|
@ -8,7 +8,7 @@ namespace Persistence.Database.Entity;
|
|||||||
public class ParameterData
|
public class ParameterData
|
||||||
{
|
{
|
||||||
[Required, Comment("Дискриминатор системы")]
|
[Required, Comment("Дискриминатор системы")]
|
||||||
public int DiscriminatorId { get; set; }
|
public Guid DiscriminatorId { get; set; }
|
||||||
|
|
||||||
[Comment("Id параметра")]
|
[Comment("Id параметра")]
|
||||||
public int ParameterId { get; set; }
|
public int ParameterId { get; set; }
|
||||||
|
@ -30,7 +30,7 @@ public class ChangeLogControllerTest : BaseIntegrationTest
|
|||||||
// arrange
|
// arrange
|
||||||
dbContext.CleanupDbSet<ChangeLog>();
|
dbContext.CleanupDbSet<ChangeLog>();
|
||||||
|
|
||||||
var idDiscriminator = 1;
|
var idDiscriminator = Guid.NewGuid();
|
||||||
var dtos = Generate(2, DateTimeOffset.UtcNow);
|
var dtos = Generate(2, DateTimeOffset.UtcNow);
|
||||||
|
|
||||||
// act
|
// act
|
||||||
@ -63,7 +63,7 @@ public class ChangeLogControllerTest : BaseIntegrationTest
|
|||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
var count = 1;
|
var count = 1;
|
||||||
var idDiscriminator = 1;
|
var idDiscriminator = Guid.NewGuid();
|
||||||
var dtos = Generate(count, DateTimeOffset.UtcNow);
|
var dtos = Generate(count, DateTimeOffset.UtcNow);
|
||||||
var dto = dtos.FirstOrDefault()!;
|
var dto = dtos.FirstOrDefault()!;
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ public class ChangeLogControllerTest : BaseIntegrationTest
|
|||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
var count = 3;
|
var count = 3;
|
||||||
var idDiscriminator = 1;
|
var idDiscriminator = Guid.NewGuid();
|
||||||
var dtos = Generate(count, DateTimeOffset.UtcNow);
|
var dtos = Generate(count, DateTimeOffset.UtcNow);
|
||||||
|
|
||||||
// act
|
// act
|
||||||
@ -97,7 +97,7 @@ public class ChangeLogControllerTest : BaseIntegrationTest
|
|||||||
// arrange
|
// arrange
|
||||||
dbContext.CleanupDbSet<ChangeLog>();
|
dbContext.CleanupDbSet<ChangeLog>();
|
||||||
|
|
||||||
var idDiscriminator = 1;
|
var idDiscriminator = Guid.NewGuid();
|
||||||
var dtos = Generate(1, DateTimeOffset.UtcNow);
|
var dtos = Generate(1, DateTimeOffset.UtcNow);
|
||||||
var dto = dtos.FirstOrDefault()!;
|
var dto = dtos.FirstOrDefault()!;
|
||||||
var result = await client.Add(idDiscriminator, dto);
|
var result = await client.Add(idDiscriminator, dto);
|
||||||
@ -298,7 +298,7 @@ public class ChangeLogControllerTest : BaseIntegrationTest
|
|||||||
var count = insertedCount;
|
var count = insertedCount;
|
||||||
var daysRange = (daysBeforeNowChangeLog, daysAfterNowChangeLog);
|
var daysRange = (daysBeforeNowChangeLog, daysAfterNowChangeLog);
|
||||||
var changeLogItems = CreateChangeLogItems(count, daysRange);
|
var changeLogItems = CreateChangeLogItems(count, daysRange);
|
||||||
var idDiscriminator = 1;
|
var idDiscriminator = changeLogItems.Item1;
|
||||||
var entities = changeLogItems.Item2;
|
var entities = changeLogItems.Item2;
|
||||||
|
|
||||||
foreach (var entity in entities)
|
foreach (var entity in entities)
|
||||||
@ -337,12 +337,12 @@ public class ChangeLogControllerTest : BaseIntegrationTest
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private (int, ChangeLog[]) CreateChangeLogItems(int count, (int, int) daysRange)
|
private (Guid, ChangeLog[]) CreateChangeLogItems(int count, (int, int) daysRange)
|
||||||
{
|
{
|
||||||
var minDayCount = daysRange.Item1;
|
var minDayCount = daysRange.Item1;
|
||||||
var maxDayCount = daysRange.Item2;
|
var maxDayCount = daysRange.Item2;
|
||||||
|
|
||||||
var idDiscriminator = 1;
|
var idDiscriminator = Guid.NewGuid();
|
||||||
var dtos = Generate(count, DateTimeOffset.UtcNow);
|
var dtos = Generate(count, DateTimeOffset.UtcNow);
|
||||||
var entities = dtos.Select(d =>
|
var entities = dtos.Select(d =>
|
||||||
{
|
{
|
||||||
|
@ -26,7 +26,7 @@ public class WitsDataControllerTest : BaseIntegrationTest
|
|||||||
//arrange
|
//arrange
|
||||||
dbContext.CleanupDbSet<ParameterData>();
|
dbContext.CleanupDbSet<ParameterData>();
|
||||||
|
|
||||||
var discriminatorId = 1;
|
var discriminatorId = Guid.NewGuid();
|
||||||
|
|
||||||
//act
|
//act
|
||||||
var response = await witsDataClient.GetDatesRangeAsync(discriminatorId, CancellationToken.None);
|
var response = await witsDataClient.GetDatesRangeAsync(discriminatorId, CancellationToken.None);
|
||||||
@ -42,7 +42,7 @@ public class WitsDataControllerTest : BaseIntegrationTest
|
|||||||
//arrange
|
//arrange
|
||||||
dbContext.CleanupDbSet<ParameterData>();
|
dbContext.CleanupDbSet<ParameterData>();
|
||||||
|
|
||||||
var discriminatorId = 1;
|
var discriminatorId = Guid.NewGuid();
|
||||||
var dateBegin = DateTimeOffset.UtcNow;
|
var dateBegin = DateTimeOffset.UtcNow;
|
||||||
var take = 1;
|
var take = 1;
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ public class WitsDataControllerTest : BaseIntegrationTest
|
|||||||
//arrange
|
//arrange
|
||||||
dbContext.CleanupDbSet<ParameterData>();
|
dbContext.CleanupDbSet<ParameterData>();
|
||||||
|
|
||||||
var discriminatorId = 1;
|
var discriminatorId = Guid.NewGuid();
|
||||||
var dateFrom = DateTimeOffset.UtcNow;
|
var dateFrom = DateTimeOffset.UtcNow;
|
||||||
var dateTo = DateTimeOffset.UtcNow;
|
var dateTo = DateTimeOffset.UtcNow;
|
||||||
var approxPointCount = 12;
|
var approxPointCount = 12;
|
||||||
@ -177,7 +177,7 @@ public class WitsDataControllerTest : BaseIntegrationTest
|
|||||||
{
|
{
|
||||||
new WitsDataDto()
|
new WitsDataDto()
|
||||||
{
|
{
|
||||||
DiscriminatorId = -1, // < 0
|
DiscriminatorId = Guid.NewGuid(),
|
||||||
Timestamped = DateTimeOffset.UtcNow,
|
Timestamped = DateTimeOffset.UtcNow,
|
||||||
Values = new List<WitsValueDto>()
|
Values = new List<WitsValueDto>()
|
||||||
{
|
{
|
||||||
@ -201,13 +201,14 @@ public class WitsDataControllerTest : BaseIntegrationTest
|
|||||||
private async Task<IEnumerable<WitsDataDto>> AddRange(int countToCreate = 10)
|
private async Task<IEnumerable<WitsDataDto>> AddRange(int countToCreate = 10)
|
||||||
{
|
{
|
||||||
var dtos = new List<WitsDataDto>();
|
var dtos = new List<WitsDataDto>();
|
||||||
|
var discriminatorId = Guid.NewGuid();
|
||||||
var timestamped = DateTimeOffset.UtcNow;
|
var timestamped = DateTimeOffset.UtcNow;
|
||||||
for (var i = 0; i < countToCreate; i++)
|
for (var i = 0; i < countToCreate; i++)
|
||||||
{
|
{
|
||||||
var random = new Random();
|
var random = new Random();
|
||||||
dtos.Add(new WitsDataDto()
|
dtos.Add(new WitsDataDto()
|
||||||
{
|
{
|
||||||
DiscriminatorId = 1,
|
DiscriminatorId = discriminatorId,
|
||||||
Timestamped = timestamped.AddSeconds(i),
|
Timestamped = timestamped.AddSeconds(i),
|
||||||
Values = new List<WitsValueDto>()
|
Values = new List<WitsValueDto>()
|
||||||
{
|
{
|
||||||
|
@ -16,7 +16,7 @@ public class ChangeLogRepository : IChangeLogRepository
|
|||||||
this.db = db;
|
this.db = db;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> AddRange(Guid idAuthor, int idDiscriminator, IEnumerable<DataWithWellDepthAndSectionDto> dtos, CancellationToken token)
|
public async Task<int> AddRange(Guid idAuthor, Guid idDiscriminator, IEnumerable<DataWithWellDepthAndSectionDto> dtos, CancellationToken token)
|
||||||
{
|
{
|
||||||
var entities = new List<ChangeLog>();
|
var entities = new List<ChangeLog>();
|
||||||
foreach (var dto in dtos)
|
foreach (var dto in dtos)
|
||||||
@ -49,7 +49,7 @@ public class ChangeLogRepository : IChangeLogRepository
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> MarkAsDeleted(Guid idEditor, int idDiscriminator, CancellationToken token)
|
public async Task<int> MarkAsDeleted(Guid idEditor, Guid idDiscriminator, CancellationToken token)
|
||||||
{
|
{
|
||||||
var query = db.Set<ChangeLog>()
|
var query = db.Set<ChangeLog>()
|
||||||
.Where(s => s.IdDiscriminator == idDiscriminator)
|
.Where(s => s.IdDiscriminator == idDiscriminator)
|
||||||
@ -75,7 +75,7 @@ public class ChangeLogRepository : IChangeLogRepository
|
|||||||
return await db.SaveChangesAsync(token);
|
return await db.SaveChangesAsync(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> ClearAndAddRange(Guid idAuthor, int idDiscriminator, IEnumerable<DataWithWellDepthAndSectionDto> dtos, CancellationToken token)
|
public async Task<int> ClearAndAddRange(Guid idAuthor, Guid idDiscriminator, IEnumerable<DataWithWellDepthAndSectionDto> dtos, CancellationToken token)
|
||||||
{
|
{
|
||||||
var result = 0;
|
var result = 0;
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ public class ChangeLogRepository : IChangeLogRepository
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async Task<PaginationContainer<DataWithWellDepthAndSectionDto>> GetByDate(
|
public async Task<PaginationContainer<DataWithWellDepthAndSectionDto>> GetByDate(
|
||||||
int idDiscriminator,
|
Guid idDiscriminator,
|
||||||
DateTimeOffset momentUtc,
|
DateTimeOffset momentUtc,
|
||||||
SectionPartRequest filterRequest,
|
SectionPartRequest filterRequest,
|
||||||
PaginationRequest paginationRequest,
|
PaginationRequest paginationRequest,
|
||||||
@ -142,14 +142,14 @@ public class ChangeLogRepository : IChangeLogRepository
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IQueryable<ChangeLog> CreateQuery(int idDiscriminator)
|
private IQueryable<ChangeLog> CreateQuery(Guid idDiscriminator)
|
||||||
{
|
{
|
||||||
var query = db.Set<ChangeLog>().Where(e => e.IdDiscriminator == idDiscriminator);
|
var query = db.Set<ChangeLog>().Where(e => e.IdDiscriminator == idDiscriminator);
|
||||||
|
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<ChangeLogDto>> GetChangeLogForInterval(int idDiscriminator, DateTimeOffset dateBegin, DateTimeOffset dateEnd, CancellationToken token)
|
public async Task<IEnumerable<ChangeLogDto>> GetChangeLogForInterval(Guid idDiscriminator, DateTimeOffset dateBegin, DateTimeOffset dateEnd, CancellationToken token)
|
||||||
{
|
{
|
||||||
var query = db.Set<ChangeLog>().Where(s => s.IdDiscriminator == idDiscriminator);
|
var query = db.Set<ChangeLog>().Where(s => s.IdDiscriminator == idDiscriminator);
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ public class ChangeLogRepository : IChangeLogRepository
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public async Task<IEnumerable<DateOnly>> GetDatesChange(int idDiscriminator, CancellationToken token)
|
public async Task<IEnumerable<DateOnly>> GetDatesChange(Guid idDiscriminator, CancellationToken token)
|
||||||
{
|
{
|
||||||
var query = db.Set<ChangeLog>().Where(e => e.IdDiscriminator == idDiscriminator);
|
var query = db.Set<ChangeLog>().Where(e => e.IdDiscriminator == idDiscriminator);
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ public class ChangeLogRepository : IChangeLogRepository
|
|||||||
return datesOnly;
|
return datesOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ChangeLog CreateEntityFromDto(Guid idAuthor, int idDiscriminator, DataWithWellDepthAndSectionDto dto)
|
private ChangeLog CreateEntityFromDto(Guid idAuthor, Guid idDiscriminator, DataWithWellDepthAndSectionDto dto)
|
||||||
{
|
{
|
||||||
var entity = new ChangeLog()
|
var entity = new ChangeLog()
|
||||||
{
|
{
|
||||||
@ -214,7 +214,7 @@ public class ChangeLogRepository : IChangeLogRepository
|
|||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<DataWithWellDepthAndSectionDto>> GetGtDate(int idDiscriminator, DateTimeOffset dateBegin, CancellationToken token)
|
public async Task<IEnumerable<DataWithWellDepthAndSectionDto>> GetGtDate(Guid idDiscriminator, DateTimeOffset dateBegin, CancellationToken token)
|
||||||
{
|
{
|
||||||
var date = dateBegin.ToUniversalTime();
|
var date = dateBegin.ToUniversalTime();
|
||||||
var query = this.db.Set<ChangeLog>()
|
var query = this.db.Set<ChangeLog>()
|
||||||
@ -228,7 +228,7 @@ public class ChangeLogRepository : IChangeLogRepository
|
|||||||
return dtos;
|
return dtos;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<DatesRangeDto?> GetDatesRange(int idDiscriminator, CancellationToken token)
|
public async Task<DatesRangeDto?> GetDatesRange(Guid idDiscriminator, CancellationToken token)
|
||||||
{
|
{
|
||||||
var query = db.Set<ChangeLog>()
|
var query = db.Set<ChangeLog>()
|
||||||
.Where(e => e.IdDiscriminator == idDiscriminator)
|
.Where(e => e.IdDiscriminator == idDiscriminator)
|
||||||
|
@ -17,7 +17,7 @@ public class ParameterRepository : IParameterRepository
|
|||||||
|
|
||||||
protected virtual IQueryable<ParameterData> GetQueryReadOnly() => db.Set<ParameterData>();
|
protected virtual IQueryable<ParameterData> GetQueryReadOnly() => db.Set<ParameterData>();
|
||||||
|
|
||||||
public async Task<DatesRangeDto> GetDatesRangeAsync(int idDiscriminator, CancellationToken token)
|
public async Task<DatesRangeDto> GetDatesRangeAsync(Guid idDiscriminator, CancellationToken token)
|
||||||
{
|
{
|
||||||
var query = GetQueryReadOnly()
|
var query = GetQueryReadOnly()
|
||||||
.Where(e => e.DiscriminatorId == idDiscriminator)
|
.Where(e => e.DiscriminatorId == idDiscriminator)
|
||||||
@ -37,7 +37,7 @@ public class ParameterRepository : IParameterRepository
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<ParameterDto>> GetPart(int idDiscriminator, DateTimeOffset dateBegin, int take, CancellationToken token)
|
public async Task<IEnumerable<ParameterDto>> GetPart(Guid idDiscriminator, DateTimeOffset dateBegin, int take, CancellationToken token)
|
||||||
{
|
{
|
||||||
var query = GetQueryReadOnly();
|
var query = GetQueryReadOnly();
|
||||||
var universalDate = dateBegin.ToUniversalTime();
|
var universalDate = dateBegin.ToUniversalTime();
|
||||||
@ -50,7 +50,7 @@ public class ParameterRepository : IParameterRepository
|
|||||||
return dtos;
|
return dtos;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<ParameterDto>> GetValuesForGraph(int discriminatorId, DateTimeOffset dateFrom, DateTimeOffset dateTo,
|
public async Task<IEnumerable<ParameterDto>> GetValuesForGraph(Guid discriminatorId, DateTimeOffset dateFrom, DateTimeOffset dateTo,
|
||||||
int approxPointsCount, int? ratio, CancellationToken token)
|
int approxPointsCount, int? ratio, CancellationToken token)
|
||||||
{
|
{
|
||||||
var query = db.Set<ParameterData>().AsNoTracking();
|
var query = db.Set<ParameterData>().AsNoTracking();
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using System;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Persistence.Models;
|
using Persistence.Models;
|
||||||
using Persistence.Models.Requests;
|
using Persistence.Models.Requests;
|
||||||
|
|
||||||
@ -16,7 +17,7 @@ public interface IChangeLogApi : ISyncWithDiscriminatorApi<DataWithWellDepthAndS
|
|||||||
/// <param name="dtos"></param>
|
/// <param name="dtos"></param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IActionResult> ClearAndAddRange(int idDiscriminator, IEnumerable<DataWithWellDepthAndSectionDto> dtos, CancellationToken token);
|
Task<IActionResult> ClearAndAddRange(Guid idDiscriminator, IEnumerable<DataWithWellDepthAndSectionDto> dtos, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получение данных на текущую дату (с пагинацией)
|
/// Получение данных на текущую дату (с пагинацией)
|
||||||
@ -26,7 +27,7 @@ public interface IChangeLogApi : ISyncWithDiscriminatorApi<DataWithWellDepthAndS
|
|||||||
/// <param name="paginationRequest">параметры запроса пагинации</param>
|
/// <param name="paginationRequest">параметры запроса пагинации</param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IActionResult> GetCurrent(int idDiscriminator, SectionPartRequest filterRequest, PaginationRequest paginationRequest, CancellationToken token);
|
Task<IActionResult> GetCurrent(Guid idDiscriminator, SectionPartRequest filterRequest, PaginationRequest paginationRequest, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получение данных на определенную дату (с пагинацией)
|
/// Получение данных на определенную дату (с пагинацией)
|
||||||
@ -37,7 +38,7 @@ public interface IChangeLogApi : ISyncWithDiscriminatorApi<DataWithWellDepthAndS
|
|||||||
/// <param name="paginationRequest">параметры запроса пагинации</param>
|
/// <param name="paginationRequest">параметры запроса пагинации</param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IActionResult> GetByDate(int idDiscriminator, DateTimeOffset moment, SectionPartRequest filterRequest, PaginationRequest paginationRequest, CancellationToken token);
|
Task<IActionResult> GetByDate(Guid idDiscriminator, DateTimeOffset moment, SectionPartRequest filterRequest, PaginationRequest paginationRequest, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получение исторических данных за определенный период времени
|
/// Получение исторических данных за определенный период времени
|
||||||
@ -47,7 +48,7 @@ public interface IChangeLogApi : ISyncWithDiscriminatorApi<DataWithWellDepthAndS
|
|||||||
/// <param name="dateEnd"></param>
|
/// <param name="dateEnd"></param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IActionResult> GetChangeLogForDate(int idDiscriminator, DateTimeOffset dateBegin, DateTimeOffset dateEnd, CancellationToken token);
|
Task<IActionResult> GetChangeLogForDate(Guid idDiscriminator, DateTimeOffset dateBegin, DateTimeOffset dateEnd, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Добавить одну запись
|
/// Добавить одну запись
|
||||||
@ -56,7 +57,7 @@ public interface IChangeLogApi : ISyncWithDiscriminatorApi<DataWithWellDepthAndS
|
|||||||
/// <param name="dto"></param>
|
/// <param name="dto"></param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IActionResult> Add(int idDiscriminator, DataWithWellDepthAndSectionDto dto, CancellationToken token);
|
Task<IActionResult> Add(Guid idDiscriminator, DataWithWellDepthAndSectionDto dto, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Добавить несколько записей
|
/// Добавить несколько записей
|
||||||
@ -65,7 +66,7 @@ public interface IChangeLogApi : ISyncWithDiscriminatorApi<DataWithWellDepthAndS
|
|||||||
/// <param name="dtos"></param>
|
/// <param name="dtos"></param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IActionResult> AddRange(int idDiscriminator, IEnumerable<DataWithWellDepthAndSectionDto> dtos, CancellationToken token);
|
Task<IActionResult> AddRange(Guid idDiscriminator, IEnumerable<DataWithWellDepthAndSectionDto> dtos, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Обновить одну запись
|
/// Обновить одну запись
|
||||||
@ -105,5 +106,5 @@ public interface IChangeLogApi : ISyncWithDiscriminatorApi<DataWithWellDepthAndS
|
|||||||
/// <param name="idDiscriminator"></param>
|
/// <param name="idDiscriminator"></param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IActionResult> GetDatesChange(int idDiscriminator, CancellationToken token);
|
Task<IActionResult> GetDatesChange(Guid idDiscriminator, CancellationToken token);
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ public interface ISyncWithDiscriminatorApi<TDto>
|
|||||||
/// <param name="take">количество записей</param>
|
/// <param name="take">количество записей</param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<ActionResult<IEnumerable<TDto>>> GetPart(int idDiscriminator, DateTimeOffset dateBegin, int take = 24 * 60 * 60, CancellationToken token = default);
|
Task<ActionResult<IEnumerable<TDto>>> GetPart(Guid idDiscriminator, DateTimeOffset dateBegin, int take = 24 * 60 * 60, CancellationToken token = default);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получить диапазон дат, для которых есть данные в репозитории
|
/// Получить диапазон дат, для которых есть данные в репозитории
|
||||||
@ -24,5 +24,5 @@ public interface ISyncWithDiscriminatorApi<TDto>
|
|||||||
/// <param name="idDiscriminator"></param>
|
/// <param name="idDiscriminator"></param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<ActionResult<DatesRangeDto>> GetDatesRangeAsync(int idDiscriminator, CancellationToken token);
|
Task<ActionResult<DatesRangeDto>> GetDatesRangeAsync(Guid idDiscriminator, CancellationToken token);
|
||||||
}
|
}
|
@ -17,7 +17,7 @@ public interface IWitsDataApi : ISyncWithDiscriminatorApi<WitsDataDto>
|
|||||||
/// <param name="approxPointsCount"></param>
|
/// <param name="approxPointsCount"></param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<ActionResult<IEnumerable<WitsDataDto>>> GetValuesForGraph(int discriminatorId, DateTimeOffset dateFrom, DateTimeOffset dateTo,
|
Task<ActionResult<IEnumerable<WitsDataDto>>> GetValuesForGraph(Guid discriminatorId, DateTimeOffset dateFrom, DateTimeOffset dateTo,
|
||||||
int approxPointsCount, CancellationToken token);
|
int approxPointsCount, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -10,8 +10,7 @@ public class ParameterDto
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Дискриминатор системы
|
/// Дискриминатор системы
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Range(0, int.MaxValue, ErrorMessage = "Дискриминатор системы не может быть меньше 0")]
|
public Guid DiscriminatorId { get; set; }
|
||||||
public int DiscriminatorId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Id параметра
|
/// Id параметра
|
||||||
|
@ -15,8 +15,7 @@ public class WitsDataDto
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Дискриминатор системы
|
/// Дискриминатор системы
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Range(0, int.MaxValue, ErrorMessage = "Дискриминатор системы не может быть меньше 0")]
|
public required Guid DiscriminatorId { get; set; }
|
||||||
public required int DiscriminatorId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Параметры
|
/// Параметры
|
||||||
|
@ -17,7 +17,7 @@ public interface IChangeLogRepository : ISyncWithDiscriminatorRepository<DataWit
|
|||||||
/// <param name="dtos"></param>
|
/// <param name="dtos"></param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<int> AddRange(Guid idAuthor, int idDiscriminator, IEnumerable<DataWithWellDepthAndSectionDto> dtos, CancellationToken token);
|
Task<int> AddRange(Guid idAuthor, Guid idDiscriminator, IEnumerable<DataWithWellDepthAndSectionDto> dtos, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Пометить записи как удаленные
|
/// Пометить записи как удаленные
|
||||||
@ -35,7 +35,7 @@ public interface IChangeLogRepository : ISyncWithDiscriminatorRepository<DataWit
|
|||||||
/// <param name="idDiscriminator">дискриминатор таблицы</param>
|
/// <param name="idDiscriminator">дискриминатор таблицы</param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<int> MarkAsDeleted(Guid idEditor, int idDiscriminator, CancellationToken token);
|
Task<int> MarkAsDeleted(Guid idEditor, Guid idDiscriminator, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Очистить и добавить новые
|
/// Очистить и добавить новые
|
||||||
@ -45,7 +45,7 @@ public interface IChangeLogRepository : ISyncWithDiscriminatorRepository<DataWit
|
|||||||
/// <param name="dtos"></param>
|
/// <param name="dtos"></param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<int> ClearAndAddRange(Guid idAuthor, int idDiscriminator, IEnumerable<DataWithWellDepthAndSectionDto> dtos, CancellationToken token);
|
Task<int> ClearAndAddRange(Guid idAuthor, Guid idDiscriminator, IEnumerable<DataWithWellDepthAndSectionDto> dtos, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Редактирование записей
|
/// Редактирование записей
|
||||||
@ -65,7 +65,7 @@ public interface IChangeLogRepository : ISyncWithDiscriminatorRepository<DataWit
|
|||||||
/// <param name="paginationRequest">параметры запроса пагинации</param>
|
/// <param name="paginationRequest">параметры запроса пагинации</param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<PaginationContainer<DataWithWellDepthAndSectionDto>> GetByDate(int idDiscriminator, DateTimeOffset moment, SectionPartRequest filterRequest, PaginationRequest paginationRequest, CancellationToken token);
|
Task<PaginationContainer<DataWithWellDepthAndSectionDto>> GetByDate(Guid idDiscriminator, DateTimeOffset moment, SectionPartRequest filterRequest, PaginationRequest paginationRequest, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получение измененных записей за период времени
|
/// Получение измененных записей за период времени
|
||||||
@ -75,7 +75,7 @@ public interface IChangeLogRepository : ISyncWithDiscriminatorRepository<DataWit
|
|||||||
/// <param name="dateEnd"></param>
|
/// <param name="dateEnd"></param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IEnumerable<ChangeLogDto>> GetChangeLogForInterval(int idDiscriminator, DateTimeOffset dateBegin, DateTimeOffset dateEnd, CancellationToken token);
|
Task<IEnumerable<ChangeLogDto>> GetChangeLogForInterval(Guid idDiscriminator, DateTimeOffset dateBegin, DateTimeOffset dateEnd, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получение списка дат, в которые происходили изменения (день, месяц, год, без времени)
|
/// Получение списка дат, в которые происходили изменения (день, месяц, год, без времени)
|
||||||
@ -83,5 +83,5 @@ public interface IChangeLogRepository : ISyncWithDiscriminatorRepository<DataWit
|
|||||||
/// <param name="idDiscriminator"></param>
|
/// <param name="idDiscriminator"></param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IEnumerable<DateOnly>> GetDatesChange(int idDiscriminator, CancellationToken token);
|
Task<IEnumerable<DateOnly>> GetDatesChange(Guid idDiscriminator, CancellationToken token);
|
||||||
}
|
}
|
||||||
|
@ -10,14 +10,14 @@ public interface IParameterRepository
|
|||||||
/// <param name="take"></param>
|
/// <param name="take"></param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IEnumerable<ParameterDto>> GetPart(int idDiscriminator, DateTimeOffset dateBegin, int take, CancellationToken token);
|
Task<IEnumerable<ParameterDto>> GetPart(Guid idDiscriminator, DateTimeOffset dateBegin, int take, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получить диапазон дат, для которых есть данные в репозитории
|
/// Получить диапазон дат, для которых есть данные в репозитории
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<DatesRangeDto> GetDatesRangeAsync(int idDiscriminator, CancellationToken token);
|
Task<DatesRangeDto> GetDatesRangeAsync(Guid idDiscriminator, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получить набор параметров (Wits) для построения графика
|
/// Получить набор параметров (Wits) для построения графика
|
||||||
@ -29,7 +29,7 @@ public interface IParameterRepository
|
|||||||
/// <param name="ratio"></param>
|
/// <param name="ratio"></param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IEnumerable<ParameterDto>> GetValuesForGraph(int discriminatorId, DateTimeOffset dateFrom, DateTimeOffset dateTo,
|
Task<IEnumerable<ParameterDto>> GetValuesForGraph(Guid discriminatorId, DateTimeOffset dateFrom, DateTimeOffset dateTo,
|
||||||
int approxPointsCount, int? ratio, CancellationToken token);
|
int approxPointsCount, int? ratio, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -15,7 +15,7 @@ public interface ISyncWithDiscriminatorRepository<TDto>
|
|||||||
/// <param name="dateBegin">дата начала</param>
|
/// <param name="dateBegin">дата начала</param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// /// <returns></returns>
|
/// /// <returns></returns>
|
||||||
Task<IEnumerable<TDto>> GetGtDate(int idDiscriminator, DateTimeOffset dateBegin, CancellationToken token);
|
Task<IEnumerable<TDto>> GetGtDate(Guid idDiscriminator, DateTimeOffset dateBegin, CancellationToken token);
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -24,5 +24,5 @@ public interface ISyncWithDiscriminatorRepository<TDto>
|
|||||||
/// <param name="idDiscriminator">дискриминатор таблицы</param>
|
/// <param name="idDiscriminator">дискриминатор таблицы</param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<DatesRangeDto?> GetDatesRange(int idDiscriminator, CancellationToken token);
|
Task<DatesRangeDto?> GetDatesRange(Guid idDiscriminator, CancellationToken token);
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ public interface IWitsDataService
|
|||||||
/// <param name="idDiscriminator"></param>
|
/// <param name="idDiscriminator"></param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<DatesRangeDto> GetDatesRangeAsync(int idDiscriminator, CancellationToken token);
|
Task<DatesRangeDto> GetDatesRangeAsync(Guid idDiscriminator, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получить порцию записей, начиная с заданной даты
|
/// Получить порцию записей, начиная с заданной даты
|
||||||
@ -23,7 +23,7 @@ public interface IWitsDataService
|
|||||||
/// <param name="take"></param>
|
/// <param name="take"></param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IEnumerable<WitsDataDto>> GetPart(int idDiscriminator, DateTimeOffset dateBegin, int take, CancellationToken token);
|
Task<IEnumerable<WitsDataDto>> GetPart(Guid idDiscriminator, DateTimeOffset dateBegin, int take, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получить диапазон дат, для которых есть данные в репозитории
|
/// Получить диапазон дат, для которых есть данные в репозитории
|
||||||
@ -34,7 +34,7 @@ public interface IWitsDataService
|
|||||||
/// <param name="approxPointsCount"></param>
|
/// <param name="approxPointsCount"></param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IEnumerable<WitsDataDto>> GetValuesForGraph(int discriminatorId, DateTimeOffset dateFrom, DateTimeOffset dateTo, int approxPointsCount, CancellationToken token);
|
Task<IEnumerable<WitsDataDto>> GetValuesForGraph(Guid discriminatorId, DateTimeOffset dateFrom, DateTimeOffset dateTo, int approxPointsCount, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Сохранить набор параметров
|
/// Сохранить набор параметров
|
||||||
|
@ -25,14 +25,14 @@ public class WitsDataService : IWitsDataService
|
|||||||
this.witsInfo = GetWitsInfo();
|
this.witsInfo = GetWitsInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<DatesRangeDto> GetDatesRangeAsync(int idDiscriminator, CancellationToken token)
|
public Task<DatesRangeDto> GetDatesRangeAsync(Guid idDiscriminator, CancellationToken token)
|
||||||
{
|
{
|
||||||
var result = witsDataRepository.GetDatesRangeAsync(idDiscriminator, token);
|
var result = witsDataRepository.GetDatesRangeAsync(idDiscriminator, token);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<WitsDataDto>> GetPart(int idDiscriminator, DateTimeOffset dateBegin, int take, CancellationToken token)
|
public async Task<IEnumerable<WitsDataDto>> GetPart(Guid idDiscriminator, DateTimeOffset dateBegin, int take, CancellationToken token)
|
||||||
{
|
{
|
||||||
var dtos = await witsDataRepository.GetPart(idDiscriminator, dateBegin, take, token);
|
var dtos = await witsDataRepository.GetPart(idDiscriminator, dateBegin, take, token);
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ public class WitsDataService : IWitsDataService
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<WitsDataDto>> GetValuesForGraph(int discriminatorId, DateTimeOffset dateFrom, DateTimeOffset dateTo,
|
public async Task<IEnumerable<WitsDataDto>> GetValuesForGraph(Guid discriminatorId, DateTimeOffset dateFrom, DateTimeOffset dateTo,
|
||||||
int approxPointsCount, CancellationToken token)
|
int approxPointsCount, CancellationToken token)
|
||||||
{
|
{
|
||||||
var intervalSec = (dateTo - dateFrom).TotalSeconds;
|
var intervalSec = (dateTo - dateFrom).TotalSeconds;
|
||||||
|
Loading…
Reference in New Issue
Block a user