Переименовать Insert на Add
This commit is contained in:
parent
efed33e648
commit
7092324a54
@ -102,10 +102,10 @@ public class SetpointController : ControllerBase, ISetpointApi
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ProducesResponseType(typeof(int), (int)HttpStatusCode.OK)]
|
[ProducesResponseType(typeof(int), (int)HttpStatusCode.OK)]
|
||||||
public async Task<IActionResult> Save(Guid setpointKey, object newValue, Guid idUser, CancellationToken token)
|
public async Task<IActionResult> Add(Guid setpointKey, object newValue, Guid idUser, CancellationToken token)
|
||||||
{
|
{
|
||||||
await setpointRepository.Save(setpointKey, newValue, idUser, token);
|
await setpointRepository.Add(setpointKey, newValue, idUser, token);
|
||||||
|
|
||||||
return Ok();
|
return CreatedAtAction(nameof(Add), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ public class TechMessagesController : ControllerBase
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ProducesResponseType(typeof(int), (int)HttpStatusCode.Created)]
|
[ProducesResponseType(typeof(int), (int)HttpStatusCode.Created)]
|
||||||
public async Task<IActionResult> InsertRange([FromBody] IEnumerable<TechMessageDto> dtos, CancellationToken token)
|
public async Task<IActionResult> AddRange([FromBody] IEnumerable<TechMessageDto> dtos, CancellationToken token)
|
||||||
{
|
{
|
||||||
var userId = User.GetUserId<Guid>();
|
var userId = User.GetUserId<Guid>();
|
||||||
foreach (var dto in dtos)
|
foreach (var dto in dtos)
|
||||||
@ -115,9 +115,9 @@ public class TechMessagesController : ControllerBase
|
|||||||
dto.UserId = userId;
|
dto.UserId = userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
var result = await techMessagesRepository.InsertRange(dtos, token);
|
var result = await techMessagesRepository.AddRange(dtos, token);
|
||||||
|
|
||||||
return CreatedAtAction(nameof(InsertRange), result);
|
return CreatedAtAction(nameof(AddRange), result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -66,9 +66,9 @@ public class TimeSeriesController<TDto> : ControllerBase, ITimeSeriesDataApi<TDt
|
|||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<IActionResult> InsertRange(IEnumerable<TDto> dtos, CancellationToken token)
|
public async Task<IActionResult> AddRange(IEnumerable<TDto> dtos, CancellationToken token)
|
||||||
{
|
{
|
||||||
var result = await timeSeriesDataRepository.InsertRange(dtos, token);
|
var result = await timeSeriesDataRepository.AddRange(dtos, token);
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,9 +32,9 @@ public class TimestampedSetController : ControllerBase
|
|||||||
/// <returns>кол-во затронутых записей</returns>
|
/// <returns>кол-во затронутых записей</returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ProducesResponseType(typeof(int), (int)HttpStatusCode.OK)]
|
[ProducesResponseType(typeof(int), (int)HttpStatusCode.OK)]
|
||||||
public async Task<IActionResult> InsertRange([FromRoute]Guid idDiscriminator, [FromBody]IEnumerable<TimestampedSetDto> sets, CancellationToken token)
|
public async Task<IActionResult> AddRange([FromRoute]Guid idDiscriminator, [FromBody]IEnumerable<TimestampedSetDto> sets, CancellationToken token)
|
||||||
{
|
{
|
||||||
var result = await repository.InsertRange(idDiscriminator, sets, token);
|
var result = await repository.AddRange(idDiscriminator, sets, token);
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ namespace Persistence.Repository.Repositories
|
|||||||
return dtos;
|
return dtos;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task Save(Guid setpointKey, object newValue, Guid idUser, CancellationToken token)
|
public async Task Add(Guid setpointKey, object newValue, Guid idUser, CancellationToken token)
|
||||||
{
|
{
|
||||||
var entity = new Setpoint()
|
var entity = new Setpoint()
|
||||||
{
|
{
|
||||||
|
@ -88,7 +88,7 @@ namespace Persistence.Repository.Repositories
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> InsertRange(IEnumerable<TechMessageDto> dtos, CancellationToken token)
|
public async Task<int> AddRange(IEnumerable<TechMessageDto> dtos, CancellationToken token)
|
||||||
{
|
{
|
||||||
|
|
||||||
var entities = new List<TechMessage>();
|
var entities = new List<TechMessage>();
|
||||||
|
@ -48,9 +48,9 @@ public class TimeSeriesDataCachedRepository<TEntity, TDto> : TimeSeriesDataRepos
|
|||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task<int> InsertRange(IEnumerable<TDto> dtos, CancellationToken token)
|
public override async Task<int> AddRange(IEnumerable<TDto> dtos, CancellationToken token)
|
||||||
{
|
{
|
||||||
var result = await base.InsertRange(dtos, token);
|
var result = await base.AddRange(dtos, token);
|
||||||
if (result > 0)
|
if (result > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ public class TimeSeriesDataRepository<TEntity, TDto> : ITimeSeriesDataRepository
|
|||||||
return dtos;
|
return dtos;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual async Task<int> InsertRange(IEnumerable<TDto> dtos, CancellationToken token)
|
public virtual async Task<int> AddRange(IEnumerable<TDto> dtos, CancellationToken token)
|
||||||
{
|
{
|
||||||
var entities = dtos.Select(d => d.Adapt<TEntity>());
|
var entities = dtos.Select(d => d.Adapt<TEntity>());
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ public class TimestampedSetRepository : ITimestampedSetRepository
|
|||||||
this.db = db;
|
this.db = db;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<int> InsertRange(Guid idDiscriminator, IEnumerable<TimestampedSetDto> sets, CancellationToken token)
|
public Task<int> AddRange(Guid idDiscriminator, IEnumerable<TimestampedSetDto> sets, CancellationToken token)
|
||||||
{
|
{
|
||||||
var entities = sets.Select(set => new TimestampedSet(idDiscriminator, set.Timestamp.ToUniversalTime(), set.Set));
|
var entities = sets.Select(set => new TimestampedSet(idDiscriminator, set.Timestamp.ToUniversalTime(), set.Set));
|
||||||
var dbSet = db.Set<TimestampedSet>();
|
var dbSet = db.Set<TimestampedSet>();
|
||||||
|
@ -40,5 +40,5 @@ public interface ISetpointApi : ISyncApi<SetpointLogDto>
|
|||||||
/// <param name="newValue">значение</param>
|
/// <param name="newValue">значение</param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IActionResult> Save(Guid setpointKey, object newValue, Guid userId, CancellationToken token);
|
Task<IActionResult> Add(Guid setpointKey, object newValue, Guid userId, CancellationToken token);
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ public interface ITimeSeriesDataApi<TDto> : ITimeSeriesBaseDataApi<TDto>
|
|||||||
/// <param name="dtos"></param>
|
/// <param name="dtos"></param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IActionResult> InsertRange(IEnumerable<TDto> dtos, CancellationToken token);
|
Task<IActionResult> AddRange(IEnumerable<TDto> dtos, CancellationToken token);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ namespace Persistence.Repositories;
|
|||||||
// throw new NotImplementedException();
|
// throw new NotImplementedException();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// public async Task<int> InsertRange(int idUser, IEnumerable<TDto> dtos, CancellationToken token)
|
// public async Task<int> AddRange(int idUser, IEnumerable<TDto> dtos, CancellationToken token)
|
||||||
// {
|
// {
|
||||||
// using var transaction = dbContext.Database.BeginTransaction();
|
// using var transaction = dbContext.Database.BeginTransaction();
|
||||||
// try
|
// try
|
||||||
|
@ -59,5 +59,5 @@ public interface ISetpointRepository
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// to do
|
/// to do
|
||||||
/// id User учесть в соответствующем методе репозитория
|
/// id User учесть в соответствующем методе репозитория
|
||||||
Task Save(Guid setpointKey, object newValue, Guid idUser, CancellationToken token);
|
Task Add(Guid setpointKey, object newValue, Guid idUser, CancellationToken token);
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ namespace Persistence.Repositories
|
|||||||
/// <param name="dtos"></param>
|
/// <param name="dtos"></param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<int> InsertRange(IEnumerable<TechMessageDto> dtos, CancellationToken token);
|
Task<int> AddRange(IEnumerable<TechMessageDto> dtos, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получение списка уникальных названий систем АБ
|
/// Получение списка уникальных названий систем АБ
|
||||||
|
@ -15,5 +15,5 @@ public interface ITimeSeriesDataRepository<TDto> : ISyncRepository<TDto>, ITimeS
|
|||||||
/// <param name="dtos"></param>
|
/// <param name="dtos"></param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<int> InsertRange(IEnumerable<TDto> dtos, CancellationToken token);
|
Task<int> AddRange(IEnumerable<TDto> dtos, CancellationToken token);
|
||||||
}
|
}
|
||||||
|
@ -55,5 +55,5 @@ public interface ITimestampedSetRepository
|
|||||||
/// <param name="sets"></param>
|
/// <param name="sets"></param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<int> InsertRange(Guid idDiscriminator, IEnumerable<TimestampedSetDto> sets, CancellationToken token);
|
Task<int> AddRange(Guid idDiscriminator, IEnumerable<TimestampedSetDto> sets, CancellationToken token);
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user