diff --git a/Persistence.API/Controllers/ChangeLogController.cs b/Persistence.API/Controllers/ChangeLogController.cs index bc66a16..a698b87 100644 --- a/Persistence.API/Controllers/ChangeLogController.cs +++ b/Persistence.API/Controllers/ChangeLogController.cs @@ -137,7 +137,7 @@ public class ChangeLogController : ControllerBase, IChangeLogApi DateTimeOffset dateEnd, CancellationToken token = default) { - var result = await repository.GetChangeLogForDate(idDiscriminator, dateBegin, dateEnd, token); + var result = await repository.GetChangeLogForInterval(idDiscriminator, dateBegin, dateEnd, token); return Ok(result); } diff --git a/Persistence.Client/Clients/IChangeLogClient.cs b/Persistence.Client/Clients/IChangeLogClient.cs index e904057..74807cc 100644 --- a/Persistence.Client/Clients/IChangeLogClient.cs +++ b/Persistence.Client/Clients/IChangeLogClient.cs @@ -11,7 +11,6 @@ public interface IChangeLogClient { private const string BaseRoute = "/api/ChangeLog"; - //[Get($"{BaseRoute}/current")] /// /// Импорт с заменой: удаление старых строк и добавление новых /// @@ -39,7 +38,7 @@ public interface IChangeLogClient /// /// [Get($"{BaseRoute}/history")] - Task>> GetChangeLogForDate(Guid idDiscriminator, DateTimeOffset dateBegin, DateTimeOffset dateEnd); + Task>> GetChangeLogForInterval(Guid idDiscriminator, DateTimeOffset dateBegin, DateTimeOffset dateEnd); /// /// Добавить одну запись diff --git a/Persistence.IntegrationTests/Controllers/ChangeLogControllerTest.cs b/Persistence.IntegrationTests/Controllers/ChangeLogControllerTest.cs index 39ea3f8..ea47c6a 100644 --- a/Persistence.IntegrationTests/Controllers/ChangeLogControllerTest.cs +++ b/Persistence.IntegrationTests/Controllers/ChangeLogControllerTest.cs @@ -97,7 +97,7 @@ public class ChangeLogControllerTest : BaseIntegrationTest var dateBegin = DateTimeOffset.UtcNow.AddDays(-1); var dateEnd = DateTimeOffset.UtcNow.AddDays(1); - var changeLogResult = await client.GetChangeLogForDate(idDiscriminator, dateBegin, dateEnd); + var changeLogResult = await client.GetChangeLogForInterval(idDiscriminator, dateBegin, dateEnd); Assert.Equal(HttpStatusCode.OK, changeLogResult.StatusCode); Assert.NotNull(changeLogResult.Content); @@ -254,7 +254,7 @@ public class ChangeLogControllerTest : BaseIntegrationTest [Theory] [InlineData(5, -15, 15, -20, 20, 10)] [InlineData(5, -15, -10, -16, -9, 5)] - public async Task GetChangeLogForDate_returns_success( + public async Task GetChangeLogForInterval_returns_success( int insertedCount, int leftCreationFromCurrentDate, int rightCreationFromCurrentDate, @@ -280,7 +280,7 @@ public class ChangeLogControllerTest : BaseIntegrationTest //act var dateBegin = DateTimeOffset.UtcNow.AddDays(leftPointFromCurrentDate); var dateEnd = DateTimeOffset.UtcNow.AddDays(rightPointFromCurrentDate); - var result = await client.GetChangeLogForDate(idDiscriminator, dateBegin, dateEnd); + var result = await client.GetChangeLogForInterval(idDiscriminator, dateBegin, dateEnd); //assert Assert.Equal(HttpStatusCode.OK, result.StatusCode); diff --git a/Persistence.Repository/Repositories/ChangeLogRepository.cs b/Persistence.Repository/Repositories/ChangeLogRepository.cs index 514fed5..09c304a 100644 --- a/Persistence.Repository/Repositories/ChangeLogRepository.cs +++ b/Persistence.Repository/Repositories/ChangeLogRepository.cs @@ -153,7 +153,7 @@ public class ChangeLogRepository : IChangeLogRepository return query; } - public async Task> GetChangeLogForDate(Guid idDiscriminator, DateTimeOffset dateBegin, DateTimeOffset dateEnd, CancellationToken token) + public async Task> GetChangeLogForInterval(Guid idDiscriminator, DateTimeOffset dateBegin, DateTimeOffset dateEnd, CancellationToken token) { var query = db.Set().Where(s => s.IdDiscriminator == idDiscriminator); @@ -177,8 +177,8 @@ public class ChangeLogRepository : IChangeLogRepository { var result = new PaginationContainer { - Skip = request.Skip ?? 0, - Take = request.Take ?? 32, + Skip = request.Skip, + Take = request.Take, Items = Enumerable.Empty(), Count = await query.CountAsync(token) }; diff --git a/Persistence/Models/ChangeLogDto.cs b/Persistence/Models/ChangeLogDto.cs index 8e28874..ba3ff5c 100644 --- a/Persistence/Models/ChangeLogDto.cs +++ b/Persistence/Models/ChangeLogDto.cs @@ -36,7 +36,7 @@ public class ChangeLogDto public DateTimeOffset? Obsolete { get; set; } /// - /// Ключ следующей записи + /// Ключ заменившей записи /// public Guid? IdNext { get; set; } diff --git a/Persistence/Models/DataWithWellDepthAndSectionDto.cs b/Persistence/Models/DataWithWellDepthAndSectionDto.cs index b3747c2..7939dd0 100644 --- a/Persistence/Models/DataWithWellDepthAndSectionDto.cs +++ b/Persistence/Models/DataWithWellDepthAndSectionDto.cs @@ -11,11 +11,6 @@ namespace Persistence.Models; /// public class DataWithWellDepthAndSectionDto { - public DataWithWellDepthAndSectionDto() - { - - } - /// /// Ключ записи /// @@ -39,5 +34,5 @@ public class DataWithWellDepthAndSectionDto /// /// Объект записи /// - public required IDictionary Value { get; set; } = default!; + public required IDictionary Value { get; set; } } diff --git a/Persistence/Models/IChangeLogDto.cs b/Persistence/Models/IChangeLogDto.cs deleted file mode 100644 index 09cfd09..0000000 --- a/Persistence/Models/IChangeLogDto.cs +++ /dev/null @@ -1,42 +0,0 @@ -namespace Persistence.Models; - -/// -/// Часть записи описывающая изменение -/// -public interface IChangeLogDto -{ - ///// - ///// Ид записи - ///// - //public int Id { get; set; } - - ///// - ///// Автор изменения - ///// - //public int IdAuthor { get; set; } - - ///// - ///// Редактор - ///// - //public int? IdEditor { get; set; } - - ///// - ///// Дата создания записи - ///// - //public DateTimeOffset Creation { get; set; } - - ///// - ///// Дата устаревания (например при удалении) - ///// - //public DateTimeOffset? Obsolete { get; set; } - - ///// - ///// Id заменяющей записи - ///// - //public int? IdNext { get; set; } - - ///// - ///// Значение - ///// - //public object Value { get; set; } -} diff --git a/Persistence/Models/ProcessMapRotorDto.cs b/Persistence/Models/ProcessMapRotorDto.cs deleted file mode 100644 index 316f07a..0000000 --- a/Persistence/Models/ProcessMapRotorDto.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Persistence.Models; -public class ProcessMapRotorDto : IChangeLogDto -{ - public string Caption { get; set; } -} diff --git a/Persistence/Models/Requests/Request.cs b/Persistence/Models/Requests/Request.cs index c1b0583..30dd38a 100644 --- a/Persistence/Models/Requests/Request.cs +++ b/Persistence/Models/Requests/Request.cs @@ -9,17 +9,17 @@ public class Request /// /// Кол-во записей пропущенных с начала таблицы в запросе от api /// - public int? Skip { get; set; } + public int Skip { get; set; } = 0; /// /// Кол-во записей в запросе от api /// - public int? Take { get; set; } + public int Take { get; set; } = 32; /// /// Сортировки: /// Содержат список названий полей сортировки /// Указать направление сортировки можно через пробел "asc" или "desc" /// - public string? SortSettings { get; set; } = string.Empty; + public string? SortSettings { get; set; } } diff --git a/Persistence/Repositories/IChangeLogRepository.cs b/Persistence/Repositories/IChangeLogRepository.cs index c885c90..2d668cc 100644 --- a/Persistence/Repositories/IChangeLogRepository.cs +++ b/Persistence/Repositories/IChangeLogRepository.cs @@ -75,7 +75,7 @@ public interface IChangeLogRepository : ISyncWithDiscriminatorRepository /// /// - Task> GetChangeLogForDate(Guid idDiscriminator, DateTimeOffset dateBegin, DateTimeOffset dateEnd, CancellationToken token); + Task> GetChangeLogForInterval(Guid idDiscriminator, DateTimeOffset dateBegin, DateTimeOffset dateEnd, CancellationToken token); /// /// Получение списка дат, в которые происходили изменения (день, месяц, год, без времени)