Привести дискриминатор системы к типу int в ChangeLog
This commit is contained in:
parent
ad2c258f99
commit
de2a7cfe04
@ -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] Guid idDiscriminator,
|
[FromRoute] int 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] Guid idDiscriminator,
|
[FromRoute] int 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] Guid idDiscriminator,
|
[FromRoute] int 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] Guid idDiscriminator,
|
[FromRoute] int 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] Guid idDiscriminator,
|
[FromRoute] int 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] Guid idDiscriminator,
|
[FromRoute] int 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] Guid idDiscriminator, CancellationToken token)
|
public async Task<IActionResult> GetDatesChange([FromRoute] int 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<IActionResult> GetPart([FromRoute] Guid idDiscriminator, DateTimeOffset dateBegin, int take = 86400, CancellationToken token = default)
|
public async Task<ActionResult<IEnumerable<DataWithWellDepthAndSectionDto>>> GetPart([FromRoute] int 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<IActionResult> GetDatesRangeAsync([FromRoute] Guid idDiscriminator, CancellationToken token)
|
public async Task<ActionResult<DatesRangeDto>> GetDatesRangeAsync([FromRoute] int idDiscriminator, CancellationToken token)
|
||||||
{
|
{
|
||||||
var result = await repository.GetDatesRange(idDiscriminator, token);
|
var result = await repository.GetDatesRange(idDiscriminator, 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(Guid idDiscriminator, IEnumerable<DataWithWellDepthAndSectionDto> dtos);
|
Task<IApiResponse<int>> ClearAndAddRange(int 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(
|
||||||
Guid idDiscriminator,
|
int 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(Guid idDiscriminator, DateTimeOffset dateBegin, DateTimeOffset dateEnd);
|
Task<IApiResponse<IEnumerable<ChangeLogDto>>> GetChangeLogForInterval(int 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(Guid idDiscriminator, DataWithWellDepthAndSectionDto dto);
|
Task<IApiResponse<int>> Add(int 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(Guid idDiscriminator, IEnumerable<DataWithWellDepthAndSectionDto> dtos);
|
Task<IApiResponse<int>> AddRange(int 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(Guid idDiscriminator);
|
Task<IApiResponse<DatesRangeDto?>> GetDatesRange(int idDiscriminator);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ public class ChangeLog : IChangeLog, IWithSectionPart
|
|||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
[Comment("Дискриминатор таблицы")]
|
[Comment("Дискриминатор таблицы")]
|
||||||
public Guid IdDiscriminator { get; set; }
|
public int 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 Guid IdDiscriminator { get; set; }
|
public int IdDiscriminator { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Значение
|
/// Значение
|
||||||
|
@ -17,7 +17,11 @@ public class PersistenceDbContext : DbContext
|
|||||||
|
|
||||||
public DbSet<ChangeLog> ChangeLog => Set<ChangeLog>();
|
public DbSet<ChangeLog> ChangeLog => Set<ChangeLog>();
|
||||||
|
|
||||||
public PersistenceDbContext(DbContextOptions options)
|
public DbSet<TechMessage> TechMessage => Set<TechMessage>();
|
||||||
|
|
||||||
|
public DbSet<ParameterData> ParameterData => Set<ParameterData>();
|
||||||
|
|
||||||
|
public PersistenceDbContext(DbContextOptions options)
|
||||||
: base(options)
|
: base(options)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Persistence.Client;
|
using Persistence.Client;
|
||||||
using Persistence.Client.Clients;
|
using Persistence.Client.Clients;
|
||||||
|
using Persistence.Database.Entity;
|
||||||
using Persistence.Database.Model;
|
using Persistence.Database.Model;
|
||||||
using Persistence.Models;
|
using Persistence.Models;
|
||||||
using Persistence.Models.Requests;
|
using Persistence.Models.Requests;
|
||||||
@ -26,8 +27,10 @@ public class ChangeLogControllerTest : BaseIntegrationTest
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task ClearAndInsertRange_InEmptyDb()
|
public async Task ClearAndInsertRange_InEmptyDb()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
var idDiscriminator = Guid.NewGuid();
|
dbContext.CleanupDbSet<ChangeLog>();
|
||||||
|
|
||||||
|
var idDiscriminator = 1;
|
||||||
var dtos = Generate(2, DateTimeOffset.UtcNow);
|
var dtos = Generate(2, DateTimeOffset.UtcNow);
|
||||||
|
|
||||||
// act
|
// act
|
||||||
@ -60,7 +63,7 @@ public class ChangeLogControllerTest : BaseIntegrationTest
|
|||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
var count = 1;
|
var count = 1;
|
||||||
var idDiscriminator = Guid.NewGuid();
|
var idDiscriminator = 1;
|
||||||
var dtos = Generate(count, DateTimeOffset.UtcNow);
|
var dtos = Generate(count, DateTimeOffset.UtcNow);
|
||||||
var dto = dtos.FirstOrDefault()!;
|
var dto = dtos.FirstOrDefault()!;
|
||||||
|
|
||||||
@ -77,7 +80,7 @@ public class ChangeLogControllerTest : BaseIntegrationTest
|
|||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
var count = 3;
|
var count = 3;
|
||||||
var idDiscriminator = Guid.NewGuid();
|
var idDiscriminator = 1;
|
||||||
var dtos = Generate(count, DateTimeOffset.UtcNow);
|
var dtos = Generate(count, DateTimeOffset.UtcNow);
|
||||||
|
|
||||||
// act
|
// act
|
||||||
@ -91,8 +94,10 @@ public class ChangeLogControllerTest : BaseIntegrationTest
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Update_returns_success()
|
public async Task Update_returns_success()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
var idDiscriminator = Guid.NewGuid();
|
dbContext.CleanupDbSet<ChangeLog>();
|
||||||
|
|
||||||
|
var idDiscriminator = 1;
|
||||||
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);
|
||||||
@ -232,9 +237,11 @@ public class ChangeLogControllerTest : BaseIntegrationTest
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task GetByDate_returns_success()
|
public async Task GetByDate_returns_success()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
//создаем записи
|
dbContext.CleanupDbSet<ChangeLog>();
|
||||||
var count = 5;
|
|
||||||
|
//создаем записи
|
||||||
|
var count = 5;
|
||||||
var changeLogItems = CreateChangeLogItems(count, (-15, 15));
|
var changeLogItems = CreateChangeLogItems(count, (-15, 15));
|
||||||
var idDiscriminator = changeLogItems.Item1;
|
var idDiscriminator = changeLogItems.Item1;
|
||||||
var entities = changeLogItems.Item2;
|
var entities = changeLogItems.Item2;
|
||||||
@ -284,12 +291,14 @@ public class ChangeLogControllerTest : BaseIntegrationTest
|
|||||||
int daysAfterNowFilter,
|
int daysAfterNowFilter,
|
||||||
int changeLogCount)
|
int changeLogCount)
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
//создаем записи
|
dbContext.CleanupDbSet<ChangeLog>();
|
||||||
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 = changeLogItems.Item1;
|
var idDiscriminator = 1;
|
||||||
var entities = changeLogItems.Item2;
|
var entities = changeLogItems.Item2;
|
||||||
|
|
||||||
foreach (var entity in entities)
|
foreach (var entity in entities)
|
||||||
@ -328,12 +337,12 @@ public class ChangeLogControllerTest : BaseIntegrationTest
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private (Guid, ChangeLog[]) CreateChangeLogItems(int count, (int, int) daysRange)
|
private (int, ChangeLog[]) CreateChangeLogItems(int count, (int, int) daysRange)
|
||||||
{
|
{
|
||||||
var minDayCount = daysRange.Item1;
|
var minDayCount = daysRange.Item1;
|
||||||
var maxDayCount = daysRange.Item2;
|
var maxDayCount = daysRange.Item2;
|
||||||
|
|
||||||
Guid idDiscriminator = Guid.NewGuid();
|
var idDiscriminator = 1;
|
||||||
var dtos = Generate(count, DateTimeOffset.UtcNow);
|
var dtos = Generate(count, DateTimeOffset.UtcNow);
|
||||||
var entities = dtos.Select(d =>
|
var entities = dtos.Select(d =>
|
||||||
{
|
{
|
||||||
|
@ -16,7 +16,7 @@ public class ChangeLogRepository : IChangeLogRepository
|
|||||||
this.db = db;
|
this.db = db;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> AddRange(Guid idAuthor, Guid idDiscriminator, IEnumerable<DataWithWellDepthAndSectionDto> dtos, CancellationToken token)
|
public async Task<int> AddRange(Guid idAuthor, int 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, Guid idDiscriminator, CancellationToken token)
|
public async Task<int> MarkAsDeleted(Guid idEditor, int 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, Guid idDiscriminator, IEnumerable<DataWithWellDepthAndSectionDto> dtos, CancellationToken token)
|
public async Task<int> ClearAndAddRange(Guid idAuthor, int 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(
|
||||||
Guid idDiscriminator,
|
int 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(Guid idDiscriminator)
|
private IQueryable<ChangeLog> CreateQuery(int 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(Guid idDiscriminator, DateTimeOffset dateBegin, DateTimeOffset dateEnd, CancellationToken token)
|
public async Task<IEnumerable<ChangeLogDto>> GetChangeLogForInterval(int 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(Guid idDiscriminator, CancellationToken token)
|
public async Task<IEnumerable<DateOnly>> GetDatesChange(int 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, Guid idDiscriminator, DataWithWellDepthAndSectionDto dto)
|
private ChangeLog CreateEntityFromDto(Guid idAuthor, int 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(Guid idDiscriminator, DateTimeOffset dateBegin, CancellationToken token)
|
public async Task<IEnumerable<DataWithWellDepthAndSectionDto>> GetGtDate(int 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(Guid idDiscriminator, CancellationToken token)
|
public async Task<DatesRangeDto?> GetDatesRange(int idDiscriminator, CancellationToken token)
|
||||||
{
|
{
|
||||||
var query = db.Set<ChangeLog>()
|
var query = db.Set<ChangeLog>()
|
||||||
.Where(e => e.IdDiscriminator == idDiscriminator)
|
.Where(e => e.IdDiscriminator == idDiscriminator)
|
||||||
|
@ -16,7 +16,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(Guid idDiscriminator, IEnumerable<DataWithWellDepthAndSectionDto> dtos, CancellationToken token);
|
Task<IActionResult> ClearAndAddRange(int idDiscriminator, IEnumerable<DataWithWellDepthAndSectionDto> dtos, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получение данных на текущую дату (с пагинацией)
|
/// Получение данных на текущую дату (с пагинацией)
|
||||||
@ -26,7 +26,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(Guid idDiscriminator, SectionPartRequest filterRequest, PaginationRequest paginationRequest, CancellationToken token);
|
Task<IActionResult> GetCurrent(int idDiscriminator, SectionPartRequest filterRequest, PaginationRequest paginationRequest, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получение данных на определенную дату (с пагинацией)
|
/// Получение данных на определенную дату (с пагинацией)
|
||||||
@ -37,7 +37,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(Guid idDiscriminator, DateTimeOffset moment, SectionPartRequest filterRequest, PaginationRequest paginationRequest, CancellationToken token);
|
Task<IActionResult> GetByDate(int idDiscriminator, DateTimeOffset moment, SectionPartRequest filterRequest, PaginationRequest paginationRequest, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получение исторических данных за определенный период времени
|
/// Получение исторических данных за определенный период времени
|
||||||
@ -47,7 +47,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(Guid idDiscriminator, DateTimeOffset dateBegin, DateTimeOffset dateEnd, CancellationToken token);
|
Task<IActionResult> GetChangeLogForDate(int idDiscriminator, DateTimeOffset dateBegin, DateTimeOffset dateEnd, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Добавить одну запись
|
/// Добавить одну запись
|
||||||
@ -56,7 +56,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(Guid idDiscriminator, DataWithWellDepthAndSectionDto dto, CancellationToken token);
|
Task<IActionResult> Add(int idDiscriminator, DataWithWellDepthAndSectionDto dto, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Добавить несколько записей
|
/// Добавить несколько записей
|
||||||
@ -65,7 +65,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(Guid idDiscriminator, IEnumerable<DataWithWellDepthAndSectionDto> dtos, CancellationToken token);
|
Task<IActionResult> AddRange(int idDiscriminator, IEnumerable<DataWithWellDepthAndSectionDto> dtos, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Обновить одну запись
|
/// Обновить одну запись
|
||||||
@ -105,5 +105,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(Guid idDiscriminator, CancellationToken token);
|
Task<IActionResult> GetDatesChange(int idDiscriminator, CancellationToken token);
|
||||||
}
|
}
|
||||||
|
@ -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, Guid idDiscriminator, IEnumerable<DataWithWellDepthAndSectionDto> dtos, CancellationToken token);
|
Task<int> AddRange(Guid idAuthor, int 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, Guid idDiscriminator, CancellationToken token);
|
Task<int> MarkAsDeleted(Guid idEditor, int 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, Guid idDiscriminator, IEnumerable<DataWithWellDepthAndSectionDto> dtos, CancellationToken token);
|
Task<int> ClearAndAddRange(Guid idAuthor, int 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(Guid idDiscriminator, DateTimeOffset moment, SectionPartRequest filterRequest, PaginationRequest paginationRequest, CancellationToken token);
|
Task<PaginationContainer<DataWithWellDepthAndSectionDto>> GetByDate(int 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(Guid idDiscriminator, DateTimeOffset dateBegin, DateTimeOffset dateEnd, CancellationToken token);
|
Task<IEnumerable<ChangeLogDto>> GetChangeLogForInterval(int 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(Guid idDiscriminator, CancellationToken token);
|
Task<IEnumerable<DateOnly>> GetDatesChange(int idDiscriminator, CancellationToken token);
|
||||||
}
|
}
|
||||||
|
@ -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(Guid idDiscriminator, DateTimeOffset dateBegin, CancellationToken token);
|
Task<IEnumerable<TDto>> GetGtDate(int 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(Guid idDiscriminator, CancellationToken token);
|
Task<DatesRangeDto?> GetDatesRange(int idDiscriminator, CancellationToken token);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user