Переименовать Insert на Add
This commit is contained in:
parent
efed33e648
commit
7092324a54
@ -102,10 +102,10 @@ public class SetpointController : ControllerBase, ISetpointApi
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[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>
|
||||
[HttpPost]
|
||||
[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>();
|
||||
foreach (var dto in dtos)
|
||||
@ -115,9 +115,9 @@ public class TechMessagesController : ControllerBase
|
||||
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>
|
||||
|
@ -66,9 +66,9 @@ public class TimeSeriesController<TDto> : ControllerBase, ITimeSeriesDataApi<TDt
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
[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);
|
||||
}
|
||||
|
||||
|
@ -32,9 +32,9 @@ public class TimestampedSetController : ControllerBase
|
||||
/// <returns>кол-во затронутых записей</returns>
|
||||
[HttpPost]
|
||||
[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);
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ namespace Persistence.Repository.Repositories
|
||||
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()
|
||||
{
|
||||
|
@ -88,7 +88,7 @@ namespace Persistence.Repository.Repositories
|
||||
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>();
|
||||
|
@ -48,9 +48,9 @@ public class TimeSeriesDataCachedRepository<TEntity, TDto> : TimeSeriesDataRepos
|
||||
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)
|
||||
{
|
||||
|
||||
|
@ -41,7 +41,7 @@ public class TimeSeriesDataRepository<TEntity, TDto> : ITimeSeriesDataRepository
|
||||
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>());
|
||||
|
||||
|
@ -20,7 +20,7 @@ public class TimestampedSetRepository : ITimestampedSetRepository
|
||||
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 dbSet = db.Set<TimestampedSet>();
|
||||
|
@ -40,5 +40,5 @@ public interface ISetpointApi : ISyncApi<SetpointLogDto>
|
||||
/// <param name="newValue">значение</param>
|
||||
/// <param name="token"></param>
|
||||
/// <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="token"></param>
|
||||
/// <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();
|
||||
// }
|
||||
|
||||
// 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();
|
||||
// try
|
||||
|
@ -59,5 +59,5 @@ public interface ISetpointRepository
|
||||
/// <returns></returns>
|
||||
/// to do
|
||||
/// 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="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<int> InsertRange(IEnumerable<TechMessageDto> dtos, CancellationToken token);
|
||||
Task<int> AddRange(IEnumerable<TechMessageDto> dtos, CancellationToken token);
|
||||
|
||||
/// <summary>
|
||||
/// Получение списка уникальных названий систем АБ
|
||||
|
@ -15,5 +15,5 @@ public interface ITimeSeriesDataRepository<TDto> : ISyncRepository<TDto>, ITimeS
|
||||
/// <param name="dtos"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <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="token"></param>
|
||||
/// <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