Правкт по результатам ревью (частично)
This commit is contained in:
parent
be2f932796
commit
231e14a4f6
@ -19,10 +19,10 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
|||||||
this.repository = repository;
|
this.repository = repository;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost("{idDiscriminator}")]
|
||||||
[ProducesResponseType(typeof(int), (int)HttpStatusCode.OK)]
|
[ProducesResponseType(typeof(int), (int)HttpStatusCode.Created)]
|
||||||
public async Task<IActionResult> Add(
|
public async Task<IActionResult> Add(
|
||||||
Guid idDiscriminator,
|
[FromRoute] Guid idDiscriminator,
|
||||||
[FromBody] DataWithWellDepthAndSectionDto dto,
|
[FromBody] DataWithWellDepthAndSectionDto dto,
|
||||||
CancellationToken token)
|
CancellationToken token)
|
||||||
{
|
{
|
||||||
@ -32,11 +32,11 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
|||||||
return CreatedAtAction(nameof(Add), result);
|
return CreatedAtAction(nameof(Add), result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("range")]
|
[HttpPost("range/{idDiscriminator}")]
|
||||||
[ProducesResponseType(typeof(int), (int)HttpStatusCode.OK)]
|
[ProducesResponseType(typeof(int), (int)HttpStatusCode.Created)]
|
||||||
public async Task<IActionResult> AddRange(
|
public async Task<IActionResult> AddRange(
|
||||||
Guid idDiscriminator,
|
[FromRoute] Guid idDiscriminator,
|
||||||
[FromBody] IEnumerable<DataWithWellDepthAndSectionDto> dtos,
|
[FromBody] IEnumerable<DataWithWellDepthAndSectionDto> dtos,
|
||||||
CancellationToken token = default)
|
CancellationToken token = default)
|
||||||
{
|
{
|
||||||
var userId = User.GetUserId<Guid>();
|
var userId = User.GetUserId<Guid>();
|
||||||
@ -65,11 +65,11 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
|||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("replace")]
|
[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(
|
||||||
Guid idDiscriminator,
|
[FromRoute] Guid idDiscriminator,
|
||||||
IEnumerable<DataWithWellDepthAndSectionDto> dtos,
|
[FromBody] IEnumerable<DataWithWellDepthAndSectionDto> dtos,
|
||||||
CancellationToken token = default)
|
CancellationToken token = default)
|
||||||
{
|
{
|
||||||
var userId = User.GetUserId<Guid>();
|
var userId = User.GetUserId<Guid>();
|
||||||
@ -101,11 +101,11 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
|||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[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(
|
||||||
Guid idDiscriminator,
|
[FromRoute] Guid idDiscriminator,
|
||||||
[FromQuery]SectionPartRequest filterRequest,
|
[FromQuery] SectionPartRequest filterRequest,
|
||||||
[FromQuery] PaginationRequest paginationRequest,
|
[FromQuery] PaginationRequest paginationRequest,
|
||||||
CancellationToken token = default)
|
CancellationToken token = default)
|
||||||
{
|
{
|
||||||
@ -115,10 +115,10 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
|||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("moment")]
|
[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(
|
||||||
Guid idDiscriminator,
|
[FromRoute] Guid idDiscriminator,
|
||||||
DateTimeOffset moment,
|
DateTimeOffset moment,
|
||||||
[FromQuery] SectionPartRequest filterRequest,
|
[FromQuery] SectionPartRequest filterRequest,
|
||||||
[FromQuery] PaginationRequest paginationRequest,
|
[FromQuery] PaginationRequest paginationRequest,
|
||||||
@ -129,11 +129,11 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
|||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("history")]
|
[HttpGet("history/{idDiscriminator}")]
|
||||||
[ProducesResponseType(typeof(IEnumerable<ChangeLogDto>), (int)HttpStatusCode.OK)]
|
[ProducesResponseType(typeof(IEnumerable<ChangeLogDto>), (int)HttpStatusCode.OK)]
|
||||||
public async Task<IActionResult> GetChangeLogForDate(
|
public async Task<IActionResult> GetChangeLogForDate(
|
||||||
Guid idDiscriminator,
|
[FromRoute] Guid idDiscriminator,
|
||||||
DateTimeOffset dateBegin,
|
DateTimeOffset dateBegin,
|
||||||
DateTimeOffset dateEnd,
|
DateTimeOffset dateEnd,
|
||||||
CancellationToken token = default)
|
CancellationToken token = default)
|
||||||
{
|
{
|
||||||
@ -142,31 +142,32 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
|||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("datesChange")]
|
[HttpGet("datesChange/{idDiscriminator}")]
|
||||||
[ProducesResponseType(typeof(IEnumerable<DateOnly>), (int)HttpStatusCode.OK)]
|
[ProducesResponseType(typeof(IEnumerable<DateOnly>), (int)HttpStatusCode.OK)]
|
||||||
public async Task<IActionResult> GetDatesChange(Guid idDiscriminator, CancellationToken token = default)
|
public async Task<IActionResult> GetDatesChange([FromRoute] Guid idDiscriminator, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
var result = await repository.GetDatesChange(idDiscriminator, token);
|
var result = await repository.GetDatesChange(idDiscriminator, token);
|
||||||
|
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("part")]
|
[HttpGet("part/{idDiscriminator}")]
|
||||||
[ProducesResponseType(typeof(IEnumerable<DataWithWellDepthAndSectionDto>), (int)HttpStatusCode.OK)]
|
[ProducesResponseType(typeof(IEnumerable<DataWithWellDepthAndSectionDto>), (int)HttpStatusCode.OK)]
|
||||||
public async Task<IActionResult> GetPart(Guid idDiscriminator, DateTimeOffset dateBegin, int take = 86400, CancellationToken token = default)
|
public async Task<IActionResult> 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);
|
||||||
|
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("datesRange")]
|
[HttpGet("datesRange/{idDiscriminator}")]
|
||||||
[ProducesResponseType(typeof(DatesRangeDto), (int)HttpStatusCode.OK)]
|
[ProducesResponseType(typeof(DatesRangeDto), (int)HttpStatusCode.OK)]
|
||||||
public async Task<IActionResult> GetDatesRangeAsync(Guid idDiscriminator, CancellationToken token = default)
|
[ProducesResponseType((int)HttpStatusCode.NoContent)]
|
||||||
|
public async Task<IActionResult> GetDatesRangeAsync([FromRoute] Guid idDiscriminator, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
var result = await repository.GetDatesRange(idDiscriminator, token);
|
var result = await repository.GetDatesRange(idDiscriminator, token);
|
||||||
|
|
||||||
if(result is null)
|
if (result is null)
|
||||||
return NoContent();
|
return NoContent();
|
||||||
|
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace Persistence.Database.Model;
|
namespace Persistence.Database.Model;
|
||||||
|
|
||||||
@ -9,69 +10,36 @@ namespace Persistence.Database.Model;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ChangeLog : IChangeLog
|
public class ChangeLog : IChangeLog
|
||||||
{
|
{
|
||||||
/// <summary>
|
[Key, Comment("Ключ записи")]
|
||||||
/// Ключ записи
|
|
||||||
/// </summary>
|
|
||||||
[Key, Column("Id")]
|
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
[Comment("Дискриминатор таблицы")]
|
||||||
/// Дискриминатор таблицы
|
|
||||||
/// </summary>
|
|
||||||
[Column("IdDiscriminator")]
|
|
||||||
public Guid IdDiscriminator { get; set; }
|
public Guid IdDiscriminator { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
[Comment("Автор изменения")]
|
||||||
/// Автор изменения
|
|
||||||
/// </summary>
|
|
||||||
[Column("IdAuthor")]
|
|
||||||
public Guid IdAuthor { get; set; }
|
public Guid IdAuthor { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
[Comment("Редактор")]
|
||||||
/// Редактор
|
|
||||||
/// </summary>
|
|
||||||
[Column("IdEditor")]
|
|
||||||
public Guid? IdEditor { get; set; }
|
public Guid? IdEditor { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
[Comment("Дата создания записи")]
|
||||||
/// Дата создания записи
|
|
||||||
/// </summary>
|
|
||||||
[Column("Creation")]
|
|
||||||
public DateTimeOffset Creation { get; set; }
|
public DateTimeOffset Creation { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
[Comment("Дата устаревания (например при удалении)")]
|
||||||
/// Дата устаревания (например при удалении)
|
|
||||||
/// </summary>
|
|
||||||
[Column("Obsolete")]
|
|
||||||
public DateTimeOffset? Obsolete { get; set; }
|
public DateTimeOffset? Obsolete { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
[Comment("Id заменяющей записи")]
|
||||||
/// Id заменяющей записи
|
|
||||||
/// </summary>
|
|
||||||
[Column("IdNext")]
|
|
||||||
public Guid? IdNext { get; set; }
|
public Guid? IdNext { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
[Comment("Глубина забоя на дату начала интервала")]
|
||||||
/// Глубина забоя на дату начала интервала
|
|
||||||
/// </summary>
|
|
||||||
[Column("DepthStart")]
|
|
||||||
public double DepthStart { get; set; }
|
public double DepthStart { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
[Comment("Глубина забоя на дату окончания интервала")]
|
||||||
/// Глубина забоя на дату окончания интервала
|
|
||||||
/// </summary>
|
|
||||||
[Column("DepthEnd")]
|
|
||||||
public double DepthEnd { get; set; }
|
public double DepthEnd { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
[Comment("Ключ секции")]
|
||||||
/// Ключ секции
|
|
||||||
/// </summary>
|
|
||||||
[Column("IdSection")]
|
|
||||||
public Guid IdSection { get; set; }
|
public Guid IdSection { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
[Column(TypeName = "jsonb"), Comment("Значение")]
|
||||||
/// Значение
|
|
||||||
/// </summary>
|
|
||||||
[Column("Value", TypeName = "jsonb")]
|
|
||||||
public required IDictionary<string, object> Value { get; set; }
|
public required IDictionary<string, object> Value { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace Persistence.Database.Model;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Persistence.Database.Model;
|
|
||||||
public interface ITimestampedData
|
public interface ITimestampedData
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -24,7 +24,7 @@ public class ChangeLogControllerTest : BaseIntegrationTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task ClearAndInsertRange()
|
public async Task ClearAndInsertRange_InEmptyDb()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
var idDiscriminator = Guid.NewGuid();
|
var idDiscriminator = Guid.NewGuid();
|
||||||
@ -38,6 +38,23 @@ public class ChangeLogControllerTest : BaseIntegrationTest
|
|||||||
Assert.Equal(2, result.Content);
|
Assert.Equal(2, result.Content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task ClearAndInsertRange_InNotEmptyDb()
|
||||||
|
{
|
||||||
|
// arrange
|
||||||
|
var insertedCount = 10;
|
||||||
|
var createdResult = CreateChangeLogItems(insertedCount, (-15, 15));
|
||||||
|
var idDiscriminator = createdResult.Item1;
|
||||||
|
var dtos = createdResult.Item2.Select(e => e.Adapt<DataWithWellDepthAndSectionDto>());
|
||||||
|
|
||||||
|
// act
|
||||||
|
var result = await client.ClearAndAddRange(idDiscriminator, dtos);
|
||||||
|
|
||||||
|
// assert
|
||||||
|
Assert.Equal(HttpStatusCode.OK, result.StatusCode);
|
||||||
|
Assert.Equal(insertedCount*2, result.Content);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task Add_returns_success()
|
public async Task Add_returns_success()
|
||||||
{
|
{
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Mapster" Version="7.4.0" />
|
<PackageReference Include="Mapster" Version="7.4.0" />
|
||||||
|
<PackageReference Include="UuidExtensions" Version="1.2.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -4,6 +4,7 @@ using Persistence.Database.Model;
|
|||||||
using Persistence.Models;
|
using Persistence.Models;
|
||||||
using Persistence.Models.Requests;
|
using Persistence.Models.Requests;
|
||||||
using Persistence.Repositories;
|
using Persistence.Repositories;
|
||||||
|
using UuidExtensions;
|
||||||
|
|
||||||
namespace Persistence.Repository.Repositories;
|
namespace Persistence.Repository.Repositories;
|
||||||
public class ChangeLogRepository : IChangeLogRepository
|
public class ChangeLogRepository : IChangeLogRepository
|
||||||
@ -17,11 +18,13 @@ public class ChangeLogRepository : IChangeLogRepository
|
|||||||
|
|
||||||
public async Task<int> AddRange(Guid idAuthor, Guid 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>();
|
||||||
foreach (var dto in dtos)
|
foreach (var dto in dtos)
|
||||||
{
|
{
|
||||||
var entity = CreateEntityFromDto(idAuthor, idDiscriminator, dto);
|
var entity = CreateEntityFromDto(idAuthor, idDiscriminator, dto);
|
||||||
db.Set<ChangeLog>().Add(entity);
|
entities.Add(entity);
|
||||||
}
|
}
|
||||||
|
db.Set<ChangeLog>().AddRange(entities);
|
||||||
|
|
||||||
var result = await db.SaveChangesAsync(token);
|
var result = await db.SaveChangesAsync(token);
|
||||||
|
|
||||||
@ -30,10 +33,18 @@ public class ChangeLogRepository : IChangeLogRepository
|
|||||||
|
|
||||||
public async Task<int> MarkAsDeleted(Guid idEditor, IEnumerable<Guid> ids, CancellationToken token)
|
public async Task<int> MarkAsDeleted(Guid idEditor, IEnumerable<Guid> ids, CancellationToken token)
|
||||||
{
|
{
|
||||||
var query = db.Set<ChangeLog>().Where(s => ids.Contains(s.Id));
|
var query = db.Set<ChangeLog>()
|
||||||
|
.Where(s => ids.Contains(s.Id))
|
||||||
|
.Where(s => s.Obsolete != null);
|
||||||
|
|
||||||
|
if(query.Count() != ids.Count())
|
||||||
|
{
|
||||||
|
throw new ArgumentException("Count of active items not equal count of ids", nameof(ids));
|
||||||
|
}
|
||||||
|
|
||||||
var entities = await query.ToArrayAsync(token);
|
var entities = await query.ToArrayAsync(token);
|
||||||
|
|
||||||
var result = await Clear(idEditor, entities, token);
|
var result = await MarkAsObsolete(idEditor, entities, token);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -43,14 +54,15 @@ public class ChangeLogRepository : IChangeLogRepository
|
|||||||
var query = db.Set<ChangeLog>()
|
var query = db.Set<ChangeLog>()
|
||||||
.Where(s => s.IdDiscriminator == idDiscriminator)
|
.Where(s => s.IdDiscriminator == idDiscriminator)
|
||||||
.Where(e => e.Obsolete == null);
|
.Where(e => e.Obsolete == null);
|
||||||
|
|
||||||
var entities = await query.ToArrayAsync(token);
|
var entities = await query.ToArrayAsync(token);
|
||||||
|
|
||||||
var result = await Clear(idEditor, entities, token);
|
var result = await MarkAsObsolete(idEditor, entities, token);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<int> Clear(Guid idEditor, IEnumerable<ChangeLog> entities, CancellationToken token)
|
private async Task<int> MarkAsObsolete(Guid idEditor, IEnumerable<ChangeLog> entities, CancellationToken token)
|
||||||
{
|
{
|
||||||
var updateTime = DateTimeOffset.UtcNow;
|
var updateTime = DateTimeOffset.UtcNow;
|
||||||
|
|
||||||
@ -66,20 +78,16 @@ public class ChangeLogRepository : IChangeLogRepository
|
|||||||
public async Task<int> ClearAndAddRange(Guid idAuthor, Guid 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;
|
||||||
using var transaction = await db.Database.BeginTransactionAsync(token);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
result += await MarkAsDeleted(idAuthor, idDiscriminator, token);
|
|
||||||
result += await AddRange(idAuthor, idDiscriminator, dtos, token);
|
|
||||||
|
|
||||||
await transaction.CommitAsync(token);
|
using var transaction = await db.Database.BeginTransactionAsync(token);
|
||||||
return result;
|
|
||||||
}
|
result += await MarkAsDeleted(idAuthor, idDiscriminator, token);
|
||||||
catch
|
result += await AddRange(idAuthor, idDiscriminator, dtos, token);
|
||||||
{
|
|
||||||
await transaction.RollbackAsync(token);
|
await transaction.CommitAsync(token);
|
||||||
throw;
|
|
||||||
}
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> UpdateRange(Guid idEditor, IEnumerable<DataWithWellDepthAndSectionDto> dtos, CancellationToken token)
|
public async Task<int> UpdateRange(Guid idEditor, IEnumerable<DataWithWellDepthAndSectionDto> dtos, CancellationToken token)
|
||||||
@ -100,7 +108,7 @@ public class ChangeLogRepository : IChangeLogRepository
|
|||||||
var updatedEntity = updatedEntities.GetValueOrDefault(dto.Id);
|
var updatedEntity = updatedEntities.GetValueOrDefault(dto.Id);
|
||||||
if(updatedEntity is null)
|
if(updatedEntity is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException($"Entity with id = {dto.Id} doesn't exist in Db", nameof(dto));
|
throw new ArgumentException($"Entity with id = {dto.Id} doesn't exist in Db", nameof(dto));
|
||||||
}
|
}
|
||||||
|
|
||||||
var newEntity = CreateEntityFromDto(idEditor, updatedEntity.IdDiscriminator, dto);
|
var newEntity = CreateEntityFromDto(idEditor, updatedEntity.IdDiscriminator, dto);
|
||||||
@ -131,6 +139,7 @@ public class ChangeLogRepository : IChangeLogRepository
|
|||||||
CancellationToken token)
|
CancellationToken token)
|
||||||
{
|
{
|
||||||
var query = BuildQuery(idDiscriminator, momentUtc, filterRequest);
|
var query = BuildQuery(idDiscriminator, momentUtc, filterRequest);
|
||||||
|
//ApplyFilter(query, , filterRequest);
|
||||||
var result = await BuildPaginationContainer(query, paginationRequest, token);
|
var result = await BuildPaginationContainer(query, paginationRequest, token);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -138,6 +147,7 @@ public class ChangeLogRepository : IChangeLogRepository
|
|||||||
|
|
||||||
private IQueryable<ChangeLog> BuildQuery(Guid idDiscriminator, DateTimeOffset momentUtc, SectionPartRequest request)
|
private IQueryable<ChangeLog> BuildQuery(Guid idDiscriminator, DateTimeOffset momentUtc, SectionPartRequest request)
|
||||||
{
|
{
|
||||||
|
momentUtc = momentUtc.ToUniversalTime();
|
||||||
var query = db.Set<ChangeLog>()
|
var query = db.Set<ChangeLog>()
|
||||||
.Where(e => e.IdDiscriminator == idDiscriminator)
|
.Where(e => e.IdDiscriminator == idDiscriminator)
|
||||||
.Where(e => e.Creation <= momentUtc)
|
.Where(e => e.Creation <= momentUtc)
|
||||||
@ -242,7 +252,7 @@ public class ChangeLogRepository : IChangeLogRepository
|
|||||||
{
|
{
|
||||||
var entity = new ChangeLog()
|
var entity = new ChangeLog()
|
||||||
{
|
{
|
||||||
Id = default,
|
Id = Uuid7.Guid(),
|
||||||
Creation = DateTimeOffset.UtcNow,
|
Creation = DateTimeOffset.UtcNow,
|
||||||
IdAuthor = idAuthor,
|
IdAuthor = idAuthor,
|
||||||
IdDiscriminator = idDiscriminator,
|
IdDiscriminator = idDiscriminator,
|
||||||
|
Loading…
Reference in New Issue
Block a user