diff --git a/Persistence.API/Controllers/SetpointController.cs b/Persistence.API/Controllers/SetpointController.cs index 108c3ef..1bae2c6 100644 --- a/Persistence.API/Controllers/SetpointController.cs +++ b/Persistence.API/Controllers/SetpointController.cs @@ -102,10 +102,10 @@ public class SetpointController : ControllerBase, ISetpointApi /// [HttpPost] [ProducesResponseType(typeof(int), (int)HttpStatusCode.OK)] - public async Task Save(Guid setpointKey, object newValue, Guid idUser, CancellationToken token) + public async Task 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); } } diff --git a/Persistence.API/Controllers/TechMessagesController.cs b/Persistence.API/Controllers/TechMessagesController.cs index 4e91802..bb26c6a 100644 --- a/Persistence.API/Controllers/TechMessagesController.cs +++ b/Persistence.API/Controllers/TechMessagesController.cs @@ -107,7 +107,7 @@ public class TechMessagesController : ControllerBase /// [HttpPost] [ProducesResponseType(typeof(int), (int)HttpStatusCode.Created)] - public async Task InsertRange([FromBody] IEnumerable dtos, CancellationToken token) + public async Task AddRange([FromBody] IEnumerable dtos, CancellationToken token) { var userId = User.GetUserId(); 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); } /// diff --git a/Persistence.API/Controllers/TimeSeriesController.cs b/Persistence.API/Controllers/TimeSeriesController.cs index 90c78c8..6991759 100644 --- a/Persistence.API/Controllers/TimeSeriesController.cs +++ b/Persistence.API/Controllers/TimeSeriesController.cs @@ -66,9 +66,9 @@ public class TimeSeriesController : ControllerBase, ITimeSeriesDataApi /// [HttpPost] - public async Task InsertRange(IEnumerable dtos, CancellationToken token) + public async Task AddRange(IEnumerable dtos, CancellationToken token) { - var result = await timeSeriesDataRepository.InsertRange(dtos, token); + var result = await timeSeriesDataRepository.AddRange(dtos, token); return Ok(result); } diff --git a/Persistence.API/Controllers/TimestampedSetController.cs b/Persistence.API/Controllers/TimestampedSetController.cs index f18e4c8..bd0e97e 100644 --- a/Persistence.API/Controllers/TimestampedSetController.cs +++ b/Persistence.API/Controllers/TimestampedSetController.cs @@ -32,9 +32,9 @@ public class TimestampedSetController : ControllerBase /// кол-во затронутых записей [HttpPost] [ProducesResponseType(typeof(int), (int)HttpStatusCode.OK)] - public async Task InsertRange([FromRoute]Guid idDiscriminator, [FromBody]IEnumerable sets, CancellationToken token) + public async Task AddRange([FromRoute]Guid idDiscriminator, [FromBody]IEnumerable sets, CancellationToken token) { - var result = await repository.InsertRange(idDiscriminator, sets, token); + var result = await repository.AddRange(idDiscriminator, sets, token); return Ok(result); } diff --git a/Persistence.Repository/Repositories/SetpointRepository.cs b/Persistence.Repository/Repositories/SetpointRepository.cs index b4557aa..8f0492c 100644 --- a/Persistence.Repository/Repositories/SetpointRepository.cs +++ b/Persistence.Repository/Repositories/SetpointRepository.cs @@ -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() { diff --git a/Persistence.Repository/Repositories/TechMessagesRepository.cs b/Persistence.Repository/Repositories/TechMessagesRepository.cs index fad8acf..04bab02 100644 --- a/Persistence.Repository/Repositories/TechMessagesRepository.cs +++ b/Persistence.Repository/Repositories/TechMessagesRepository.cs @@ -88,7 +88,7 @@ namespace Persistence.Repository.Repositories return result; } - public async Task InsertRange(IEnumerable dtos, CancellationToken token) + public async Task AddRange(IEnumerable dtos, CancellationToken token) { var entities = new List(); diff --git a/Persistence.Repository/Repositories/TimeSeriesDataCachedRepository.cs b/Persistence.Repository/Repositories/TimeSeriesDataCachedRepository.cs index 20dbe00..2037f09 100644 --- a/Persistence.Repository/Repositories/TimeSeriesDataCachedRepository.cs +++ b/Persistence.Repository/Repositories/TimeSeriesDataCachedRepository.cs @@ -48,9 +48,9 @@ public class TimeSeriesDataCachedRepository : TimeSeriesDataRepos return items; } - public override async Task InsertRange(IEnumerable dtos, CancellationToken token) + public override async Task AddRange(IEnumerable dtos, CancellationToken token) { - var result = await base.InsertRange(dtos, token); + var result = await base.AddRange(dtos, token); if (result > 0) { diff --git a/Persistence.Repository/Repositories/TimeSeriesDataRepository.cs b/Persistence.Repository/Repositories/TimeSeriesDataRepository.cs index d73caf7..0e58c76 100644 --- a/Persistence.Repository/Repositories/TimeSeriesDataRepository.cs +++ b/Persistence.Repository/Repositories/TimeSeriesDataRepository.cs @@ -41,7 +41,7 @@ public class TimeSeriesDataRepository : ITimeSeriesDataRepository return dtos; } - public virtual async Task InsertRange(IEnumerable dtos, CancellationToken token) + public virtual async Task AddRange(IEnumerable dtos, CancellationToken token) { var entities = dtos.Select(d => d.Adapt()); diff --git a/Persistence.Repository/Repositories/TimestampedSetRepository.cs b/Persistence.Repository/Repositories/TimestampedSetRepository.cs index ad9a6cf..a67b823 100644 --- a/Persistence.Repository/Repositories/TimestampedSetRepository.cs +++ b/Persistence.Repository/Repositories/TimestampedSetRepository.cs @@ -20,7 +20,7 @@ public class TimestampedSetRepository : ITimestampedSetRepository this.db = db; } - public Task InsertRange(Guid idDiscriminator, IEnumerable sets, CancellationToken token) + public Task AddRange(Guid idDiscriminator, IEnumerable sets, CancellationToken token) { var entities = sets.Select(set => new TimestampedSet(idDiscriminator, set.Timestamp.ToUniversalTime(), set.Set)); var dbSet = db.Set(); diff --git a/Persistence/API/ISetpointApi.cs b/Persistence/API/ISetpointApi.cs index d05fe12..0d23d69 100644 --- a/Persistence/API/ISetpointApi.cs +++ b/Persistence/API/ISetpointApi.cs @@ -40,5 +40,5 @@ public interface ISetpointApi : ISyncApi /// значение /// /// - Task Save(Guid setpointKey, object newValue, Guid userId, CancellationToken token); + Task Add(Guid setpointKey, object newValue, Guid userId, CancellationToken token); } diff --git a/Persistence/API/ITimeSeriesDataApi.cs b/Persistence/API/ITimeSeriesDataApi.cs index a2406aa..51b9332 100644 --- a/Persistence/API/ITimeSeriesDataApi.cs +++ b/Persistence/API/ITimeSeriesDataApi.cs @@ -28,7 +28,7 @@ public interface ITimeSeriesDataApi : ITimeSeriesBaseDataApi /// /// /// - Task InsertRange(IEnumerable dtos, CancellationToken token); + Task AddRange(IEnumerable dtos, CancellationToken token); } diff --git a/Persistence/Repositories/AbstractChangeLogRepository.cs b/Persistence/Repositories/AbstractChangeLogRepository.cs index 88cf511..d7b1cbc 100644 --- a/Persistence/Repositories/AbstractChangeLogRepository.cs +++ b/Persistence/Repositories/AbstractChangeLogRepository.cs @@ -74,7 +74,7 @@ namespace Persistence.Repositories; // throw new NotImplementedException(); // } -// public async Task InsertRange(int idUser, IEnumerable dtos, CancellationToken token) +// public async Task AddRange(int idUser, IEnumerable dtos, CancellationToken token) // { // using var transaction = dbContext.Database.BeginTransaction(); // try diff --git a/Persistence/Repositories/ISetpointRepository.cs b/Persistence/Repositories/ISetpointRepository.cs index 1fe41de..502b44a 100644 --- a/Persistence/Repositories/ISetpointRepository.cs +++ b/Persistence/Repositories/ISetpointRepository.cs @@ -59,5 +59,5 @@ public interface ISetpointRepository /// /// to do /// id User учесть в соответствующем методе репозитория - Task Save(Guid setpointKey, object newValue, Guid idUser, CancellationToken token); + Task Add(Guid setpointKey, object newValue, Guid idUser, CancellationToken token); } diff --git a/Persistence/Repositories/ITechMessagesRepository.cs b/Persistence/Repositories/ITechMessagesRepository.cs index 853f234..2ddf71c 100644 --- a/Persistence/Repositories/ITechMessagesRepository.cs +++ b/Persistence/Repositories/ITechMessagesRepository.cs @@ -22,7 +22,7 @@ namespace Persistence.Repositories /// /// /// - Task InsertRange(IEnumerable dtos, CancellationToken token); + Task AddRange(IEnumerable dtos, CancellationToken token); /// /// Получение списка уникальных названий систем АБ diff --git a/Persistence/Repositories/ITimeSeriesDataRepository.cs b/Persistence/Repositories/ITimeSeriesDataRepository.cs index 9de7fc7..aa2c9ff 100644 --- a/Persistence/Repositories/ITimeSeriesDataRepository.cs +++ b/Persistence/Repositories/ITimeSeriesDataRepository.cs @@ -15,5 +15,5 @@ public interface ITimeSeriesDataRepository : ISyncRepository, ITimeS /// /// /// - Task InsertRange(IEnumerable dtos, CancellationToken token); + Task AddRange(IEnumerable dtos, CancellationToken token); } diff --git a/Persistence/Repositories/ITimestampedSetRepository.cs b/Persistence/Repositories/ITimestampedSetRepository.cs index 27627c3..c350739 100644 --- a/Persistence/Repositories/ITimestampedSetRepository.cs +++ b/Persistence/Repositories/ITimestampedSetRepository.cs @@ -55,5 +55,5 @@ public interface ITimestampedSetRepository /// /// /// - Task InsertRange(Guid idDiscriminator, IEnumerable sets, CancellationToken token); + Task AddRange(Guid idDiscriminator, IEnumerable sets, CancellationToken token); } \ No newline at end of file