diff --git a/Persistence.Client/Clients/IChangeLogClient.cs b/Persistence.Client/Clients/IChangeLogClient.cs index dcbc9e2..06bbc4d 100644 --- a/Persistence.Client/Clients/IChangeLogClient.cs +++ b/Persistence.Client/Clients/IChangeLogClient.cs @@ -66,20 +66,18 @@ public interface IChangeLogClient /// /// Обновить одну запись /// - /// /// /// - [Put($"{BaseRoute}/{{idDiscriminator}}")] - Task> Update(Guid idDiscriminator, DataWithWellDepthAndSectionDto dto); + [Put($"{BaseRoute}")] + Task> Update(DataWithWellDepthAndSectionDto dto); /// /// Обновить несколько записей /// - /// /// /// - [Put($"{BaseRoute}/range/{{idDiscriminator}}")] - Task> UpdateRange(Guid idDiscriminator, IEnumerable dtos); + [Put($"{BaseRoute}/range")] + Task> UpdateRange(IEnumerable dtos); /// /// Удалить одну запись @@ -102,7 +100,7 @@ public interface IChangeLogClient /// /// /// - [Get($"{BaseRoute}/datesRange")] + [Get($"{BaseRoute}/datesRange/{{idDiscriminator}}")] Task> GetDatesRange(Guid idDiscriminator); } diff --git a/Persistence.IntegrationTests/Controllers/ChangeLogControllerTest.cs b/Persistence.IntegrationTests/Controllers/ChangeLogControllerTest.cs index 8fc572a..8c3b422 100644 --- a/Persistence.IntegrationTests/Controllers/ChangeLogControllerTest.cs +++ b/Persistence.IntegrationTests/Controllers/ChangeLogControllerTest.cs @@ -105,7 +105,7 @@ public class ChangeLogControllerTest : BaseIntegrationTest dto.DepthEnd = dto.DepthEnd + 10; // act - result = await client.Update(idDiscriminator, dto); + result = await client.Update(dto); // assert Assert.Equal(HttpStatusCode.OK, result.StatusCode); @@ -143,7 +143,6 @@ public class ChangeLogControllerTest : BaseIntegrationTest { // arrange var count = 2; - var idDiscriminator = Guid.NewGuid(); var dtos = Generate(count, DateTimeOffset.UtcNow); var entities = dtos.Select(d => d.Adapt()).ToArray(); dbContext.ChangeLog.AddRange(entities); @@ -159,7 +158,7 @@ public class ChangeLogControllerTest : BaseIntegrationTest }).ToArray(); // act - var result = await client.UpdateRange(idDiscriminator, dtos); + var result = await client.UpdateRange(dtos); // assert Assert.Equal(HttpStatusCode.OK, result.StatusCode); @@ -298,7 +297,7 @@ public class ChangeLogControllerTest : BaseIntegrationTest entity.DepthEnd = entity.DepthEnd + 10; } var dtos = entities.Select(e => e.Adapt()).ToArray(); - await client.UpdateRange(idDiscriminator, dtos); + await client.UpdateRange(dtos); //act var dateBegin = DateTimeOffset.UtcNow.AddDays(daysBeforeNowFilter); diff --git a/Persistence.Repository/Repositories/ChangeLogRepository.cs b/Persistence.Repository/Repositories/ChangeLogRepository.cs index 78c2eba..53eba23 100644 --- a/Persistence.Repository/Repositories/ChangeLogRepository.cs +++ b/Persistence.Repository/Repositories/ChangeLogRepository.cs @@ -241,7 +241,9 @@ public class ChangeLogRepository : IChangeLogRepository .Select(group => new { Min = group.Min(e => e.Creation), - Max = group.Max(e => (e.Creation > e.Obsolete ? e.Creation : e.Obsolete!.Value)), + Max = group.Max(e => (e.Obsolete.HasValue && e.Obsolete > e.Creation) + ? e.Obsolete.Value + : e.Creation), }); var values = await query.FirstOrDefaultAsync(token);