2024-11-12 13:36:09 +05:00
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using Persistence.Models;
|
2024-11-08 18:24:52 +05:00
|
|
|
|
|
|
|
|
|
namespace Persistence.API;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2024-11-12 13:36:09 +05:00
|
|
|
|
/// Интерфейс для работы с API журнала изменений
|
2024-11-08 18:24:52 +05:00
|
|
|
|
/// </summary>
|
2024-11-14 15:17:43 +05:00
|
|
|
|
public interface IChangeLogApi<TDto, TChangeLogDto>
|
2024-11-08 18:24:52 +05:00
|
|
|
|
where TDto : class, new()
|
|
|
|
|
where TChangeLogDto : ChangeLogDto<TDto>
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Получение исторических данных на текущую дату
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="token"></param>
|
|
|
|
|
/// <returns></returns>
|
2024-11-12 13:36:09 +05:00
|
|
|
|
Task<ActionResult<IEnumerable<TDto>>> GetChangeLogCurrent(CancellationToken token);
|
2024-11-08 18:24:52 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Получение исторических данных на определенную дату
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="historyMoment"></param>
|
|
|
|
|
/// <param name="token"></param>
|
|
|
|
|
/// <returns></returns>
|
2024-11-12 13:36:09 +05:00
|
|
|
|
Task<ActionResult<IEnumerable<TChangeLogDto>>> GetChangeLogForDate(DateTimeOffset historyMoment, CancellationToken token);
|
|
|
|
|
|
2024-11-08 18:24:52 +05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Добавить одну запись
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="dto"></param>
|
|
|
|
|
/// <param name="token"></param>
|
|
|
|
|
/// <returns></returns>
|
2024-11-12 13:36:09 +05:00
|
|
|
|
Task<ActionResult<int>> AddAsync(TDto dto, CancellationToken token);
|
2024-11-08 18:24:52 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Добавить несколько записей
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="dtos"></param>
|
|
|
|
|
/// <param name="token"></param>
|
|
|
|
|
/// <returns></returns>
|
2024-11-12 13:36:09 +05:00
|
|
|
|
Task<ActionResult<int>> AddRangeAsync(IEnumerable<TDto> dtos, CancellationToken token);
|
2024-11-08 18:24:52 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Обновить одну запись
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="dto"></param>
|
|
|
|
|
/// <param name="token"></param>
|
|
|
|
|
/// <returns></returns>
|
2024-11-12 13:36:09 +05:00
|
|
|
|
Task<ActionResult<int>> UpdateAsync(TDto dto, CancellationToken token);
|
2024-11-08 18:24:52 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Обновить несколько записей
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="dtos"></param>
|
|
|
|
|
/// <param name="token"></param>
|
|
|
|
|
/// <returns></returns>
|
2024-11-12 13:36:09 +05:00
|
|
|
|
Task<ActionResult<int>> UpdateRangeAsync(IEnumerable<TDto> dtos, CancellationToken token);
|
2024-11-08 18:24:52 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Удалить одну запись
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="id"></param>
|
|
|
|
|
/// <param name="token"></param>
|
|
|
|
|
/// <returns></returns>
|
2024-11-12 13:36:09 +05:00
|
|
|
|
Task<ActionResult<int>> DeleteAsync(int id, CancellationToken token);
|
2024-11-08 18:24:52 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Удалить несколько записей
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="ids"></param>
|
|
|
|
|
/// <param name="token"></param>
|
|
|
|
|
/// <returns></returns>
|
2024-11-12 13:36:09 +05:00
|
|
|
|
Task<ActionResult<int>> DeleteRangeAsync(IEnumerable<int> ids, CancellationToken token);
|
2024-11-08 18:24:52 +05:00
|
|
|
|
}
|