diff --git a/Persistence.API/Controllers/ChangeLogController.cs b/Persistence.API/Controllers/ChangeLogController.cs index a698b87..233af58 100644 --- a/Persistence.API/Controllers/ChangeLogController.cs +++ b/Persistence.API/Controllers/ChangeLogController.cs @@ -27,7 +27,7 @@ public class ChangeLogController : ControllerBase, IChangeLogApi CancellationToken token) { var userId = User.GetUserId(); - var result = await repository.InsertRange(userId, idDiscriminator, [dto], token); + var result = await repository.AddRange(userId, idDiscriminator, [dto], token); return CreatedAtAction(nameof(Add), result); } @@ -40,7 +40,7 @@ public class ChangeLogController : ControllerBase, IChangeLogApi CancellationToken token = default) { var userId = User.GetUserId(); - var result = await repository.InsertRange(userId, idDiscriminator, dtos, token); + var result = await repository.AddRange(userId, idDiscriminator, dtos, token); return CreatedAtAction(nameof(AddRange), result); } @@ -67,25 +67,24 @@ public class ChangeLogController : ControllerBase, IChangeLogApi [HttpPost("replace")] [ProducesResponseType(typeof(int), (int)HttpStatusCode.OK)] - public async Task ClearAndInsertRange( + public async Task ClearAndAddRange( Guid idDiscriminator, IEnumerable dtos, CancellationToken token = default) { var userId = User.GetUserId(); - var result = await repository.ClearAndInsertRange(userId, idDiscriminator, dtos, token); + var result = await repository.ClearAndAddRange(userId, idDiscriminator, dtos, token); return Ok(result); } [HttpPut] [ProducesResponseType(typeof(int), (int)HttpStatusCode.OK)] public async Task Update( - Guid idDiscriminator, DataWithWellDepthAndSectionDto dto, CancellationToken token = default) { var userId = User.GetUserId(); - var result = await repository.UpdateRange(userId, idDiscriminator, [dto], token); + var result = await repository.UpdateRange(userId, [dto], token); return Ok(result); } @@ -93,12 +92,11 @@ public class ChangeLogController : ControllerBase, IChangeLogApi [HttpPut("range")] [ProducesResponseType(typeof(int), (int)HttpStatusCode.OK)] public async Task UpdateRange( - Guid idDiscriminator, IEnumerable dtos, CancellationToken token = default) { var userId = User.GetUserId(); - var result = await repository.UpdateRange(userId, idDiscriminator, dtos, token); + var result = await repository.UpdateRange(userId, dtos, token); return Ok(result); } @@ -107,11 +105,12 @@ public class ChangeLogController : ControllerBase, IChangeLogApi [ProducesResponseType(typeof(PaginationContainer), (int)HttpStatusCode.OK)] public async Task GetCurrent( Guid idDiscriminator, - [FromQuery]SectionPartRequest request, + [FromQuery]SectionPartRequest filterRequest, + [FromQuery] PaginationRequest paginationRequest, CancellationToken token = default) { var moment = new DateTimeOffset(3000, 1, 1, 0, 0, 0, TimeSpan.Zero); - var result = await repository.GetByDate(idDiscriminator, moment, request, token); + var result = await repository.GetByDate(idDiscriminator, moment, filterRequest, paginationRequest, token); return Ok(result); } @@ -121,10 +120,11 @@ public class ChangeLogController : ControllerBase, IChangeLogApi public async Task GetByDate( Guid idDiscriminator, DateTimeOffset moment, - [FromQuery] SectionPartRequest request, + [FromQuery] SectionPartRequest filterRequest, + [FromQuery] PaginationRequest paginationRequest, CancellationToken token = default) { - var result = await repository.GetByDate(idDiscriminator, moment, request, token); + var result = await repository.GetByDate(idDiscriminator, moment, filterRequest, paginationRequest, token); return Ok(result); } diff --git a/Persistence.Client/Clients/IChangeLogClient.cs b/Persistence.Client/Clients/IChangeLogClient.cs index 74807cc..4f1cc60 100644 --- a/Persistence.Client/Clients/IChangeLogClient.cs +++ b/Persistence.Client/Clients/IChangeLogClient.cs @@ -18,17 +18,22 @@ public interface IChangeLogClient /// /// [Post($"{BaseRoute}/replace")] - Task> ClearAndInsertRange(Guid idDiscriminator, IEnumerable dtos); + Task> ClearAndAddRange(Guid idDiscriminator, IEnumerable dtos); /// /// Получение актуальных данных на определенную дату (с пагинацией) /// /// /// - /// параметры запроса + /// параметры запроса фильтрации + /// параметры запроса пагинации /// [Get($"{BaseRoute}/moment")] - Task>> GetByDate(Guid idDiscriminator, DateTimeOffset moment, [Query] SectionPartRequest request); + Task>> GetByDate( + Guid idDiscriminator, + DateTimeOffset moment, + [Query] SectionPartRequest filterRequest, + [Query] PaginationRequest paginationRequest); /// /// Получение исторических данных за определенный период времени diff --git a/Persistence.IntegrationTests/Controllers/ChangeLogControllerTest.cs b/Persistence.IntegrationTests/Controllers/ChangeLogControllerTest.cs index ea47c6a..0f24bb8 100644 --- a/Persistence.IntegrationTests/Controllers/ChangeLogControllerTest.cs +++ b/Persistence.IntegrationTests/Controllers/ChangeLogControllerTest.cs @@ -31,7 +31,7 @@ public class ChangeLogControllerTest : BaseIntegrationTest var dtos = Generate(2, DateTimeOffset.UtcNow); // act - var result = await client.ClearAndInsertRange(idDiscriminator, dtos); + var result = await client.ClearAndAddRange(idDiscriminator, dtos); // assert Assert.Equal(HttpStatusCode.OK, result.StatusCode); @@ -51,7 +51,7 @@ public class ChangeLogControllerTest : BaseIntegrationTest var result = await client.Add(idDiscriminator, dto); // assert - Assert.Equal(HttpStatusCode.OK, result.StatusCode); + Assert.Equal(HttpStatusCode.Created, result.StatusCode); Assert.Equal(count, result.Content); } @@ -67,7 +67,7 @@ public class ChangeLogControllerTest : BaseIntegrationTest var result = await client.AddRange(idDiscriminator, dtos); // assert - Assert.Equal(HttpStatusCode.OK, result.StatusCode); + Assert.Equal(HttpStatusCode.Created, result.StatusCode); Assert.Equal(count, result.Content); } @@ -79,7 +79,7 @@ public class ChangeLogControllerTest : BaseIntegrationTest var dtos = Generate(1, DateTimeOffset.UtcNow); var dto = dtos.FirstOrDefault()!; var result = await client.Add(idDiscriminator, dto); - Assert.Equal(HttpStatusCode.OK, result.StatusCode); + Assert.Equal(HttpStatusCode.Created, result.StatusCode); var entity = dbContext.ChangeLog .Where(x => x.IdDiscriminator == idDiscriminator) @@ -230,7 +230,13 @@ public class ChangeLogControllerTest : BaseIntegrationTest var deletedCount = await client.DeleteRange(idsToDelete); - var request = new SectionPartRequest() + var filterRequest = new SectionPartRequest() + { + DepthStart = 0, + DepthEnd = 1000, + }; + + var paginationRequest = new PaginationRequest() { Skip = 0, Take = 10, @@ -238,7 +244,7 @@ public class ChangeLogControllerTest : BaseIntegrationTest }; var moment = DateTimeOffset.UtcNow.AddDays(16); - var result = await client.GetByDate(idDiscriminator, moment, request); + var result = await client.GetByDate(idDiscriminator, moment, filterRequest, paginationRequest); Assert.Equal(HttpStatusCode.OK, result.StatusCode); Assert.NotNull(result.Content); @@ -256,16 +262,16 @@ public class ChangeLogControllerTest : BaseIntegrationTest [InlineData(5, -15, -10, -16, -9, 5)] public async Task GetChangeLogForInterval_returns_success( int insertedCount, - int leftCreationFromCurrentDate, - int rightCreationFromCurrentDate, - int leftPointFromCurrentDate, - int rightPointFromCurrentDate, + int daysBeforeNowChangeLog, + int daysAfterNowChangeLog, + int daysBeforeNowFilter, + int daysAfterNowFilter, int changeLogCount) { // arrange //создаем записи var count = insertedCount; - var daysRange = (leftCreationFromCurrentDate, rightCreationFromCurrentDate); + var daysRange = (daysBeforeNowChangeLog, daysAfterNowChangeLog); var changeLogItems = CreateChangeLogItems(count, daysRange); var idDiscriminator = changeLogItems.Item1; var entities = changeLogItems.Item2; @@ -278,8 +284,8 @@ public class ChangeLogControllerTest : BaseIntegrationTest await client.UpdateRange(idDiscriminator, dtos); //act - var dateBegin = DateTimeOffset.UtcNow.AddDays(leftPointFromCurrentDate); - var dateEnd = DateTimeOffset.UtcNow.AddDays(rightPointFromCurrentDate); + var dateBegin = DateTimeOffset.UtcNow.AddDays(daysBeforeNowFilter); + var dateEnd = DateTimeOffset.UtcNow.AddDays(daysAfterNowFilter); var result = await client.GetChangeLogForInterval(idDiscriminator, dateBegin, dateEnd); //assert diff --git a/Persistence.Repository/Repositories/ChangeLogRepository.cs b/Persistence.Repository/Repositories/ChangeLogRepository.cs index 09c304a..07159d7 100644 --- a/Persistence.Repository/Repositories/ChangeLogRepository.cs +++ b/Persistence.Repository/Repositories/ChangeLogRepository.cs @@ -15,11 +15,11 @@ public class ChangeLogRepository : IChangeLogRepository this.db = db; } - public async Task InsertRange(Guid idUser, Guid idDiscriminator, IEnumerable dtos, CancellationToken token) + public async Task AddRange(Guid idAuthor, Guid idDiscriminator, IEnumerable dtos, CancellationToken token) { foreach (var dto in dtos) { - var entity = CreateEntityFromDto(idUser, idDiscriminator, dto); + var entity = CreateEntityFromDto(idAuthor, idDiscriminator, dto); db.Set().Add(entity); } @@ -28,49 +28,49 @@ public class ChangeLogRepository : IChangeLogRepository return result; } - public async Task MarkAsDeleted(Guid idUser, IEnumerable ids, CancellationToken token) + public async Task MarkAsDeleted(Guid idEditor, IEnumerable ids, CancellationToken token) { var query = db.Set().Where(s => ids.Contains(s.Id)); var entities = await query.ToArrayAsync(token); - var result = await Clear(idUser, entities, token); + var result = await Clear(idEditor, entities, token); return result; } - public async Task MarkAsDeleted(Guid idUser, Guid idDiscriminator, CancellationToken token) + public async Task MarkAsDeleted(Guid idEditor, Guid idDiscriminator, CancellationToken token) { var query = db.Set() .Where(s => s.IdDiscriminator == idDiscriminator) .Where(e => e.Obsolete == null); var entities = await query.ToArrayAsync(token); - var result = await Clear(idUser, entities, token); + var result = await Clear(idEditor, entities, token); return result; } - private async Task Clear(Guid idUser, IEnumerable entities, CancellationToken token) + private async Task Clear(Guid idEditor, IEnumerable entities, CancellationToken token) { var updateTime = DateTimeOffset.UtcNow; foreach (var entity in entities) { entity.Obsolete = updateTime; - entity.IdEditor = idUser; + entity.IdEditor = idEditor; } return await db.SaveChangesAsync(token); } - public async Task ClearAndInsertRange(Guid idUser, Guid idDiscriminator, IEnumerable dtos, CancellationToken token) + public async Task ClearAndAddRange(Guid idAuthor, Guid idDiscriminator, IEnumerable dtos, CancellationToken token) { var result = 0; using var transaction = await db.Database.BeginTransactionAsync(token); try { - result += await MarkAsDeleted(idUser, idDiscriminator, token); - result += await InsertRange(idUser, idDiscriminator, dtos, token); + result += await MarkAsDeleted(idAuthor, idDiscriminator, token); + result += await AddRange(idAuthor, idDiscriminator, dtos, token); await transaction.CommitAsync(token); return result; @@ -82,7 +82,7 @@ public class ChangeLogRepository : IChangeLogRepository } } - public async Task UpdateRange(Guid idUser, Guid idDiscriminator, IEnumerable dtos, CancellationToken token) + public async Task UpdateRange(Guid idEditor, IEnumerable dtos, CancellationToken token) { var dbSet = db.Set(); @@ -97,13 +97,18 @@ public class ChangeLogRepository : IChangeLogRepository { foreach (var dto in dtos) { - var newEntity = CreateEntityFromDto(idUser, idDiscriminator, dto); + var updatedEntity = updatedEntities.GetValueOrDefault(dto.Id); + if(updatedEntity is null) + { + throw new ArgumentNullException($"Entity with id = {dto.Id} doesn't exist in Db", nameof(dto)); + } + + var newEntity = CreateEntityFromDto(idEditor, updatedEntity.IdDiscriminator, dto); dbSet.Add(newEntity); - var updatedEntity = updatedEntities.GetValueOrDefault(dto.Id)!; updatedEntity.IdNext = newEntity.Id; updatedEntity.Obsolete = DateTimeOffset.UtcNow; - updatedEntity.IdEditor = idUser; + updatedEntity.IdEditor = idEditor; } result = await db.SaveChangesAsync(token); @@ -121,11 +126,12 @@ public class ChangeLogRepository : IChangeLogRepository public async Task> GetByDate( Guid idDiscriminator, DateTimeOffset momentUtc, - SectionPartRequest request, + SectionPartRequest filterRequest, + PaginationRequest paginationRequest, CancellationToken token) { - var query = BuildQuery(idDiscriminator, momentUtc, request); - var result = await BuildPaginationContainer(query, request, token); + var query = BuildQuery(idDiscriminator, momentUtc, filterRequest); + var result = await BuildPaginationContainer(query, paginationRequest, token); return result; } @@ -173,7 +179,7 @@ public class ChangeLogRepository : IChangeLogRepository - private async Task> BuildPaginationContainer(IQueryable query, SectionPartRequest request, CancellationToken token) + private async Task> BuildPaginationContainer(IQueryable query, PaginationRequest request, CancellationToken token) { var result = new PaginationContainer { @@ -232,15 +238,15 @@ public class ChangeLogRepository : IChangeLogRepository return datesOnly; } - private ChangeLog CreateEntityFromDto(Guid idUser, Guid idDiscriminator, DataWithWellDepthAndSectionDto dto) + private ChangeLog CreateEntityFromDto(Guid idAuthor, Guid idDiscriminator, DataWithWellDepthAndSectionDto dto) { var entity = new ChangeLog() { Id = default, Creation = DateTimeOffset.UtcNow, - IdAuthor = idUser, + IdAuthor = idAuthor, IdDiscriminator = idDiscriminator, - IdEditor = idUser, + IdEditor = idAuthor, Value = dto.Value, IdSection = dto.IdSection, diff --git a/Persistence/API/IChangeLogApi.cs b/Persistence/API/IChangeLogApi.cs index 40ca8ae..25b5158 100644 --- a/Persistence/API/IChangeLogApi.cs +++ b/Persistence/API/IChangeLogApi.cs @@ -16,26 +16,28 @@ public interface IChangeLogApi : ISyncWithDiscriminatorApi /// /// - Task ClearAndInsertRange(Guid idDiscriminator, IEnumerable dtos, CancellationToken token); + Task ClearAndAddRange(Guid idDiscriminator, IEnumerable dtos, CancellationToken token); /// /// Получение данных на текущую дату (с пагинацией) /// /// - /// параметры запроса + /// параметры запроса фильтрации + /// параметры запроса пагинации /// /// - Task GetCurrent(Guid idDiscriminator, SectionPartRequest request, CancellationToken token); + Task GetCurrent(Guid idDiscriminator, SectionPartRequest filterRequest, PaginationRequest paginationRequest, CancellationToken token); /// /// Получение данных на определенную дату (с пагинацией) /// /// /// - /// параметры запроса + /// параметры запроса фильтрации + /// параметры запроса пагинации /// /// - Task GetByDate(Guid idDiscriminator, DateTimeOffset moment, SectionPartRequest request, CancellationToken token); + Task GetByDate(Guid idDiscriminator, DateTimeOffset moment, SectionPartRequest filterRequest, PaginationRequest paginationRequest, CancellationToken token); /// /// Получение исторических данных за определенный период времени @@ -68,20 +70,18 @@ public interface IChangeLogApi : ISyncWithDiscriminatorApi /// Обновить одну запись /// - /// /// /// /// - Task Update(Guid idDiscriminator, DataWithWellDepthAndSectionDto dto, CancellationToken token); + Task Update(DataWithWellDepthAndSectionDto dto, CancellationToken token); /// /// Обновить несколько записей /// - /// /// /// /// - Task UpdateRange(Guid idDiscriminator, IEnumerable dtos, CancellationToken token); + Task UpdateRange(IEnumerable dtos, CancellationToken token); /// /// Удалить одну запись diff --git a/Persistence/API/ITableDataApi.cs b/Persistence/API/ITableDataApi.cs index 075559a..e5611a4 100644 --- a/Persistence/API/ITableDataApi.cs +++ b/Persistence/API/ITableDataApi.cs @@ -7,7 +7,7 @@ namespace Persistence.API; /// Интерфейс для API, предназначенного для работы с табличными данными public interface ITableDataApi where TDto : class, new() - where TRequest : Request + where TRequest : PaginationRequest { /// /// Получить страницу списка объектов diff --git a/Persistence/Models/Requests/Request.cs b/Persistence/Models/Requests/PaginationRequest.cs similarity index 96% rename from Persistence/Models/Requests/Request.cs rename to Persistence/Models/Requests/PaginationRequest.cs index 30dd38a..d9974cd 100644 --- a/Persistence/Models/Requests/Request.cs +++ b/Persistence/Models/Requests/PaginationRequest.cs @@ -4,7 +4,7 @@ /// Контейнер для поддержки постраничного просмотра таблиц /// /// -public class Request +public class PaginationRequest { /// /// Кол-во записей пропущенных с начала таблицы в запросе от api diff --git a/Persistence/Models/Requests/SectionPartRequest.cs b/Persistence/Models/Requests/SectionPartRequest.cs index a05082d..3eca015 100644 --- a/Persistence/Models/Requests/SectionPartRequest.cs +++ b/Persistence/Models/Requests/SectionPartRequest.cs @@ -3,7 +3,7 @@ /// /// Запрос для фильтрации данных по секции и глубине /// -public class SectionPartRequest : Request +public class SectionPartRequest { /// /// Глубина забоя на дату начала интервала diff --git a/Persistence/Repositories/AbstractChangeLogRepository.cs b/Persistence/Repositories/AbstractChangeLogRepository.cs deleted file mode 100644 index 88cf511..0000000 --- a/Persistence/Repositories/AbstractChangeLogRepository.cs +++ /dev/null @@ -1,165 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Persistence.Models; -using System.Linq; - -namespace Persistence.Repositories; -//public abstract class AbstractChangeLogRepository : IChangeLogRepository -// where TDto : class, new() -// where TEntity : class, IChangeLogAbstract -// where TChangeLogDto : ChangeLogDto -//{ -// private readonly DbContext dbContext; - -// protected AbstractChangeLogRepository(DbContext dbContext) -// { -// this.dbContext = dbContext; -// } - -// public abstract TEntity Convert(TDto entity); -// public async Task Clear(int idUser,CancellationToken token) -// { -// throw new NotImplementedException(); - -// //var updateTime = DateTimeOffset.UtcNow; - -// ////todo -// //var query = BuildQuery(request); -// //query = query.Where(e => e.Obsolete == null); - -// //var entitiesToDelete = await query.ToArrayAsync(token); - -// //foreach (var entity in entitiesToDelete) -// //{ -// // entity.IdState = IChangeLogAbstract.IdCleared; -// // entity.Obsolete = updateTime; -// // entity.IdEditor = idUser; -// //} - -// //var result = await SaveChangesWithExceptionHandling(token); -// //return result; -// } - -// public async Task ClearAndInsertRange(int idUser, IEnumerable dtos, CancellationToken token) -// { -// var result = 0; -// using var transaction = await dbContext.Database.BeginTransactionAsync(token); -// try -// { -// result += await Clear(idUser, token); -// result += await InsertRangeWithoutTransaction(idUser, dtos, token); - -// await transaction.CommitAsync(token); -// return result; -// } -// catch -// { -// await transaction.RollbackAsync(token); -// throw; -// } -// } - -// public Task> GetCurrent(DateTimeOffset moment, CancellationToken token) -// { -// throw new NotImplementedException(); -// } - -// public Task> GetDatesChange(CancellationToken token) -// { -// throw new NotImplementedException(); -// } - -// public Task> GetGtDate(DateTimeOffset date, CancellationToken token) -// { -// throw new NotImplementedException(); -// } - -// public async Task InsertRange(int idUser, IEnumerable dtos, CancellationToken token) -// { -// using var transaction = dbContext.Database.BeginTransaction(); -// try -// { -// var result = await InsertRangeWithoutTransaction(idUser, dtos, token); -// await transaction.CommitAsync(token); -// return result; -// } -// catch -// { -// await transaction.RollbackAsync(token); -// throw; -// } -// } - -// protected abstract DatabaseFacade GetDataBase(); - -// public Task MarkAsDeleted(int idUser, IEnumerable ids, CancellationToken token) -// { -// throw new NotImplementedException(); -// } - -// public Task UpdateOrInsertRange(int idUser, IEnumerable dtos, CancellationToken token) -// { -// throw new NotImplementedException(); -// } - -// public Task UpdateRange(int idUser, IEnumerable dtos, CancellationToken token) -// { -// throw new NotImplementedException(); -// } - -// public Task> GetChangeLogForDate(DateTimeOffset? updateFrom, CancellationToken token) -// { -// throw new NotImplementedException(); -// } - -// private async Task InsertRangeWithoutTransaction(int idUser, IEnumerable dtos, CancellationToken token) -// { -// var result = 0; -// if (dtos.Any()) -// { -// var entities = dtos.Select(Convert); -// var creation = DateTimeOffset.UtcNow; -// var dbSet = dbContext.Set(); -// foreach (var entity in entities) -// { -// entity.Id = default; -// entity.IdAuthor = idUser; -// entity.Creation = creation; -// entity.IdState = IChangeLogAbstract.IdStateActual; -// entity.IdEditor = null; -// entity.IdPrevious = null; -// entity.Obsolete = null; -// dbSet.Add(entity); -// } - -// result += await SaveChangesWithExceptionHandling(token); -// } - -// return result; -// } - -// private async Task SaveChangesWithExceptionHandling(CancellationToken token) -// { -// var result = await dbContext.SaveChangesAsync(token); -// return result; -// //try -// //{ -// // var result = await dbContext.SaveChangesAsync(token); -// // return result; -// //} -// //catch (DbUpdateException ex) -// //{ -// // if (ex.InnerException is PostgresException pgException) -// // TryConvertPostgresExceptionToValidateException(pgException); -// // throw; -// //} -// } - - - -// //private static void TryConvertPostgresExceptionToValidateException(PostgresException pgException) -// //{ -// // if (pgException.SqlState == PostgresErrorCodes.ForeignKeyViolation) -// // throw new ArgumentInvalidException("dtos", pgException.Message + "\r\n" + pgException.Detail); -// //} -//} diff --git a/Persistence/Repositories/IChangeLogRepository.cs b/Persistence/Repositories/IChangeLogRepository.cs index 2d668cc..e197090 100644 --- a/Persistence/Repositories/IChangeLogRepository.cs +++ b/Persistence/Repositories/IChangeLogRepository.cs @@ -12,60 +12,60 @@ public interface IChangeLogRepository : ISyncWithDiscriminatorRepository /// Добавление записей /// - /// пользователь, который добавляет + /// пользователь, который добавляет /// ключ справочника /// /// /// - Task InsertRange(Guid idUser, Guid idDiscriminator, IEnumerable dtos, CancellationToken token); + Task AddRange(Guid idAuthor, Guid idDiscriminator, IEnumerable dtos, CancellationToken token); /// /// Пометить записи как удаленные /// - /// + /// /// ключи записей /// /// - Task MarkAsDeleted(Guid idUser, IEnumerable ids, CancellationToken token); + Task MarkAsDeleted(Guid idEditor, IEnumerable ids, CancellationToken token); /// /// Пометить записи как удаленные /// - /// + /// /// дискриминатор таблицы /// /// - Task MarkAsDeleted(Guid idUser, Guid idDiscriminator, CancellationToken token); + Task MarkAsDeleted(Guid idEditor, Guid idDiscriminator, CancellationToken token); /// /// Очистить и добавить новые /// - /// + /// /// /// /// /// - Task ClearAndInsertRange(Guid idUser, Guid idDiscriminator, IEnumerable dtos, CancellationToken token); + Task ClearAndAddRange(Guid idAuthor, Guid idDiscriminator, IEnumerable dtos, CancellationToken token); /// /// Редактирование записей /// - /// пользователь, который редактирует - /// + /// пользователь, который редактирует /// /// /// - Task UpdateRange(Guid idUser, Guid idDiscriminator, IEnumerable dtos, CancellationToken token); + Task UpdateRange(Guid idEditor, IEnumerable dtos, CancellationToken token); /// /// Получение актуальных записей на определенный момент времени (с пагинацией) /// /// /// текущий момент времени - /// параметры запроса + /// параметры запроса фильтрации + /// параметры запроса пагинации /// /// - Task> GetByDate(Guid idDiscriminator, DateTimeOffset moment, SectionPartRequest request, CancellationToken token); + Task> GetByDate(Guid idDiscriminator, DateTimeOffset moment, SectionPartRequest filterRequest, PaginationRequest paginationRequest, CancellationToken token); /// /// Получение измененных записей за период времени diff --git a/Persistence/Repositories/ITableDataRepository.cs b/Persistence/Repositories/ITableDataRepository.cs index 574ff76..0ca1715 100644 --- a/Persistence/Repositories/ITableDataRepository.cs +++ b/Persistence/Repositories/ITableDataRepository.cs @@ -7,7 +7,7 @@ namespace Persistence.Repositories; /// public interface ITableDataRepository where TDto : class, new() - where TRequest : Request + where TRequest : PaginationRequest { /// /// Получить страницу списка объектов