80 lines
2.6 KiB
C#
80 lines
2.6 KiB
C#
|
using Persistence.Models;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
namespace Persistence.API;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Интерфейс для работы с API, предназначенного для CRUD-операций над данными
|
|||
|
/// </summary>
|
|||
|
public interface IApiChangeLog<TDto, TChangeLogDto>
|
|||
|
where TDto : class, new()
|
|||
|
where TChangeLogDto : ChangeLogDto<TDto>
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// Получение исторических данных на текущую дату
|
|||
|
/// </summary>
|
|||
|
/// <param name="token"></param>
|
|||
|
/// <returns></returns>
|
|||
|
Task<IEnumerable<TDto>> GetChangeLogCurrent(CancellationToken token);
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Получение исторических данных на определенную дату
|
|||
|
/// </summary>
|
|||
|
/// <param name="historyMoment"></param>
|
|||
|
/// <param name="token"></param>
|
|||
|
/// <returns></returns>
|
|||
|
Task<IEnumerable<TChangeLogDto>> GetChangeLogForDate(DateTimeOffset historyMoment, CancellationToken token);
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Добавить одну запись
|
|||
|
/// </summary>
|
|||
|
/// <param name="dto"></param>
|
|||
|
/// <param name="token"></param>
|
|||
|
/// <returns></returns>
|
|||
|
Task<int> AddAsync(TDto dto, CancellationToken token);
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Добавить несколько записей
|
|||
|
/// </summary>
|
|||
|
/// <param name="dtos"></param>
|
|||
|
/// <param name="token"></param>
|
|||
|
/// <returns></returns>
|
|||
|
Task<int> AddRangeAsync(IEnumerable<TDto> dtos, CancellationToken token);
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Обновить одну запись
|
|||
|
/// </summary>
|
|||
|
/// <param name="dto"></param>
|
|||
|
/// <param name="token"></param>
|
|||
|
/// <returns></returns>
|
|||
|
Task<int> UpdateAsync(TDto dto, CancellationToken token);
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Обновить несколько записей
|
|||
|
/// </summary>
|
|||
|
/// <param name="dtos"></param>
|
|||
|
/// <param name="token"></param>
|
|||
|
/// <returns></returns>
|
|||
|
Task<int> UpdateRangeAsync(IEnumerable<TDto> dtos, CancellationToken token);
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Удалить одну запись
|
|||
|
/// </summary>
|
|||
|
/// <param name="id"></param>
|
|||
|
/// <param name="token"></param>
|
|||
|
/// <returns></returns>
|
|||
|
Task<int> DeleteAsync(int id, CancellationToken token);
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Удалить несколько записей
|
|||
|
/// </summary>
|
|||
|
/// <param name="ids"></param>
|
|||
|
/// <param name="token"></param>
|
|||
|
/// <returns></returns>
|
|||
|
Task<int> DeleteRangeAsync(IEnumerable<int> ids, CancellationToken token);
|
|||
|
}
|