diff --git a/Persistence.API/Controllers/ChangeLogController.cs b/Persistence.API/Controllers/ChangeLogController.cs index 8bfa32f..08f059e 100644 --- a/Persistence.API/Controllers/ChangeLogController.cs +++ b/Persistence.API/Controllers/ChangeLogController.cs @@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Mvc; using Persistence.Models; using Persistence.Models.Requests; using Persistence.Repositories; +using System.Net; namespace Persistence.API.Controllers; @@ -19,7 +20,8 @@ public class ChangeLogController : ControllerBase, IChangeLogApi } [HttpPost] - public async Task> Add( + [ProducesResponseType(typeof(int), (int)HttpStatusCode.OK)] + public async Task Add( Guid idDiscriminator, [FromBody] DataWithWellDepthAndSectionDto dto, CancellationToken token) @@ -31,7 +33,8 @@ public class ChangeLogController : ControllerBase, IChangeLogApi } [HttpPost("range")] - public async Task> AddRange( + [ProducesResponseType(typeof(int), (int)HttpStatusCode.OK)] + public async Task AddRange( Guid idDiscriminator, [FromBody] IEnumerable dtos, CancellationToken token) { @@ -42,7 +45,8 @@ public class ChangeLogController : ControllerBase, IChangeLogApi } [HttpDelete] - public async Task> Delete(Guid id, CancellationToken token) + [ProducesResponseType(typeof(int), (int)HttpStatusCode.OK)] + public async Task Delete(Guid id, CancellationToken token) { var userId = User.GetUserId(); var result = await repository.MarkAsDeleted(userId, [id], token); @@ -51,7 +55,8 @@ public class ChangeLogController : ControllerBase, IChangeLogApi } [HttpDelete("range")] - public async Task> DeleteRange(IEnumerable ids, CancellationToken token) + [ProducesResponseType(typeof(int), (int)HttpStatusCode.OK)] + public async Task DeleteRange(IEnumerable ids, CancellationToken token) { var userId = User.GetUserId(); var result = await repository.MarkAsDeleted(userId, ids, token); @@ -60,6 +65,7 @@ public class ChangeLogController : ControllerBase, IChangeLogApi } [HttpPost("replace")] + [ProducesResponseType(typeof(int), (int)HttpStatusCode.OK)] public async Task ClearAndInsertRange( Guid idDiscriminator, IEnumerable dtos, @@ -71,7 +77,8 @@ public class ChangeLogController : ControllerBase, IChangeLogApi } [HttpPut] - public async Task> Update( + [ProducesResponseType(typeof(int), (int)HttpStatusCode.OK)] + public async Task Update( Guid idDiscriminator, DataWithWellDepthAndSectionDto dto, CancellationToken token) @@ -83,7 +90,8 @@ public class ChangeLogController : ControllerBase, IChangeLogApi } [HttpPut("range")] - public async Task> UpdateRange( + [ProducesResponseType(typeof(int), (int)HttpStatusCode.OK)] + public async Task UpdateRange( Guid idDiscriminator, IEnumerable dtos, CancellationToken token) @@ -95,7 +103,8 @@ public class ChangeLogController : ControllerBase, IChangeLogApi } [HttpGet] - public async Task>> GetCurrent( + [ProducesResponseType(typeof(PaginationContainer), (int)HttpStatusCode.OK)] + public async Task GetCurrent( Guid idDiscriminator, [FromQuery]SectionPartRequest request, CancellationToken token) @@ -107,7 +116,8 @@ public class ChangeLogController : ControllerBase, IChangeLogApi } [HttpGet("moment")] - public async Task>> GetByDate( + [ProducesResponseType(typeof(PaginationContainer), (int)HttpStatusCode.OK)] + public async Task GetByDate( Guid idDiscriminator, DateTimeOffset moment, SectionPartRequest request, @@ -119,7 +129,8 @@ public class ChangeLogController : ControllerBase, IChangeLogApi } [HttpGet("history")] - public async Task>> GetChangeLogForDate(Guid idDiscriminator, DateTimeOffset dateBegin, DateTimeOffset dateEnd, CancellationToken token) + [ProducesResponseType(typeof(IEnumerable), (int)HttpStatusCode.OK)] + public async Task GetChangeLogForDate(Guid idDiscriminator, DateTimeOffset dateBegin, DateTimeOffset dateEnd, CancellationToken token) { var result = await repository.GetChangeLogForDate(idDiscriminator, dateBegin, dateEnd, token); @@ -127,7 +138,8 @@ public class ChangeLogController : ControllerBase, IChangeLogApi } [HttpGet("datesChange")] - public async Task>> GetDatesChange(Guid idDiscriminator, CancellationToken token) + [ProducesResponseType(typeof(IEnumerable), (int)HttpStatusCode.OK)] + public async Task GetDatesChange(Guid idDiscriminator, CancellationToken token) { var result = await repository.GetDatesChange(idDiscriminator, token); diff --git a/Persistence/API/IChangeLogApi.cs b/Persistence/API/IChangeLogApi.cs index a0f75a0..a46fc98 100644 --- a/Persistence/API/IChangeLogApi.cs +++ b/Persistence/API/IChangeLogApi.cs @@ -25,7 +25,7 @@ public interface IChangeLogApi /// параметры запроса /// /// - Task>> GetCurrent(Guid idDiscriminator, SectionPartRequest request, CancellationToken token); + Task GetCurrent(Guid idDiscriminator, SectionPartRequest request, CancellationToken token); /// /// Получение данных на определенную дату (с пагинацией) @@ -35,7 +35,7 @@ public interface IChangeLogApi /// параметры запроса /// /// - Task>> GetByDate(Guid idDiscriminator, DateTimeOffset moment, SectionPartRequest request, CancellationToken token); + Task GetByDate(Guid idDiscriminator, DateTimeOffset moment, SectionPartRequest request, CancellationToken token); /// /// Получение исторических данных за определенный период времени @@ -45,7 +45,7 @@ public interface IChangeLogApi /// /// /// - Task>> GetChangeLogForDate(Guid idDiscriminator, DateTimeOffset dateBegin, DateTimeOffset dateEnd, CancellationToken token); + Task GetChangeLogForDate(Guid idDiscriminator, DateTimeOffset dateBegin, DateTimeOffset dateEnd, CancellationToken token); /// /// Добавить одну запись @@ -54,7 +54,7 @@ public interface IChangeLogApi /// /// /// - Task> Add(Guid idDiscriminator, DataWithWellDepthAndSectionDto dto, CancellationToken token); + Task Add(Guid idDiscriminator, DataWithWellDepthAndSectionDto dto, CancellationToken token); /// /// Добавить несколько записей @@ -63,7 +63,7 @@ public interface IChangeLogApi /// /// /// - Task> AddRange(Guid idDiscriminator, IEnumerable dtos, CancellationToken token); + Task AddRange(Guid idDiscriminator, IEnumerable dtos, CancellationToken token); /// /// Обновить одну запись @@ -72,7 +72,7 @@ public interface IChangeLogApi /// /// /// - Task> Update(Guid idDiscriminator, DataWithWellDepthAndSectionDto dto, CancellationToken token); + Task Update(Guid idDiscriminator, DataWithWellDepthAndSectionDto dto, CancellationToken token); /// /// Обновить несколько записей @@ -81,7 +81,7 @@ public interface IChangeLogApi /// /// /// - Task> UpdateRange(Guid idDiscriminator, IEnumerable dtos, CancellationToken token); + Task UpdateRange(Guid idDiscriminator, IEnumerable dtos, CancellationToken token); /// /// Удалить одну запись @@ -89,7 +89,7 @@ public interface IChangeLogApi /// /// /// - Task> Delete(Guid id, CancellationToken token); + Task Delete(Guid id, CancellationToken token); /// /// Удалить несколько записей @@ -97,7 +97,7 @@ public interface IChangeLogApi /// /// /// - Task> DeleteRange(IEnumerable ids, CancellationToken token); + Task DeleteRange(IEnumerable ids, CancellationToken token); /// /// Получение списка дат, в которые происходили изменения (день, месяц, год, без времени) @@ -105,5 +105,5 @@ public interface IChangeLogApi /// /// /// - Task>> GetDatesChange(Guid idDiscriminator, CancellationToken token); + Task GetDatesChange(Guid idDiscriminator, CancellationToken token); }