2024-10-31 17:02:48 +05:00
|
|
|
|
using Persistence.Models;
|
|
|
|
|
|
|
|
|
|
namespace Persistence.Repositories;
|
2024-10-31 15:01:12 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2024-11-02 12:05:12 +05:00
|
|
|
|
/// Интерфейс для работы с историческими данными
|
2024-10-31 15:01:12 +05:00
|
|
|
|
/// </summary>
|
2024-10-31 17:02:48 +05:00
|
|
|
|
/// <typeparam name="TDto"></typeparam>
|
2024-11-01 12:26:14 +05:00
|
|
|
|
public interface IChangeLogRepository<TDto, TChangeLogDto> : ISyncRepository<TDto>
|
2024-10-31 17:02:48 +05:00
|
|
|
|
where TDto : class
|
2024-11-02 12:05:12 +05:00
|
|
|
|
where TChangeLogDto : ChangeLogDto<TDto>
|
2024-10-31 15:01:12 +05:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Добавление записей
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="idUser">пользователь, который добавляет</param>
|
|
|
|
|
/// <param name="dtos"></param>
|
|
|
|
|
/// <param name="token"></param>
|
|
|
|
|
/// <returns></returns>
|
2024-10-31 17:02:48 +05:00
|
|
|
|
Task<int> InsertRange(int idUser, IEnumerable<TDto> dtos, CancellationToken token);
|
2024-10-31 15:01:12 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Редактирование записей
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="idUser">пользователь, который редактирует</param>
|
|
|
|
|
/// <param name="dtos"></param>
|
|
|
|
|
/// <param name="token"></param>
|
|
|
|
|
/// <returns></returns>
|
2024-10-31 17:02:48 +05:00
|
|
|
|
Task<int> UpdateRange(int idUser, IEnumerable<TDto> dtos, CancellationToken token);
|
2024-10-31 15:01:12 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Добавляет Dto у которых id == 0, изменяет dto у которых id != 0
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="idUser">пользователь, который редактирует или добавляет</param>
|
|
|
|
|
/// <param name="dtos"></param>
|
|
|
|
|
/// <param name="token"></param>
|
|
|
|
|
/// <returns></returns>
|
2024-10-31 17:02:48 +05:00
|
|
|
|
Task<int> UpdateOrInsertRange(int idUser, IEnumerable<TDto> dtos, CancellationToken token);
|
2024-10-31 15:01:12 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Помечает записи как удаленные
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="idUser">пользователь, который чистит</param>
|
|
|
|
|
/// <param name="token"></param>
|
|
|
|
|
/// <returns></returns>
|
2024-11-02 12:05:12 +05:00
|
|
|
|
Task<int> Clear(int idUser, CancellationToken token);
|
2024-10-31 15:01:12 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Очистить и добавить новые
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="idUser"></param>
|
|
|
|
|
/// <param name="dtos"></param>
|
|
|
|
|
/// <param name="token"></param>
|
|
|
|
|
/// <returns></returns>
|
2024-11-02 12:05:12 +05:00
|
|
|
|
Task<int> ClearAndInsertRange(int idUser, IEnumerable<TDto> dtos, CancellationToken token);
|
2024-10-31 15:01:12 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Пометить записи как удаленные
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="idUser"></param>
|
|
|
|
|
/// <param name="ids"></param>
|
|
|
|
|
/// <param name="token"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
Task<int> MarkAsDeleted(int idUser, IEnumerable<int> ids, CancellationToken token);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Получение дат изменений записей
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
/// <param name="token"></param>
|
|
|
|
|
/// <returns></returns>
|
2024-11-02 12:05:12 +05:00
|
|
|
|
Task<IEnumerable<DateOnly>> GetDatesChange(CancellationToken token);
|
2024-10-31 15:01:12 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Получение измененных записей за определенную дату
|
|
|
|
|
/// </summary>
|
2024-11-02 12:05:12 +05:00
|
|
|
|
/// <param name="updateFrom"></param>
|
2024-10-31 15:01:12 +05:00
|
|
|
|
/// <param name="token"></param>
|
|
|
|
|
/// <returns></returns>
|
2024-11-02 12:05:12 +05:00
|
|
|
|
Task<IEnumerable<TChangeLogDto>> GetChangeLogForDate(DateTimeOffset? updateFrom, CancellationToken token);
|
2024-10-31 15:01:12 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Получение текущих сейчас записей по параметрам
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
/// <param name="token"></param>
|
|
|
|
|
/// <returns></returns>
|
2024-11-02 12:05:12 +05:00
|
|
|
|
Task<IEnumerable<TDto>> GetCurrent(DateTimeOffset moment, CancellationToken token);
|
2024-10-31 15:01:12 +05:00
|
|
|
|
}
|