DD.WellWorkover.Cloud/AsbCloudApp/Repositories/IChangeLogRepository.cs

97 lines
3.5 KiB
C#
Raw Normal View History

using AsbCloudApp.Data;
using AsbCloudApp.Requests;
using System;
2024-01-26 17:23:21 +05:00
using System.Collections.Generic;
2024-01-19 17:48:45 +05:00
using System.Threading;
using System.Threading.Tasks;
namespace AsbCloudApp.Repositories;
/// <summary>
/// Репозиторий для записей с историей
/// </summary>
2024-01-26 17:23:21 +05:00
public interface IChangeLogRepository<TDto, TRequest>
where TDto : AsbCloudApp.Data.IId
2024-01-26 17:23:21 +05:00
where TRequest : ChangeLogBaseRequest
2024-01-19 17:48:45 +05:00
{
/// <summary>
/// Добавление записей
/// </summary>
/// <param name="idUser"></param>
/// <param name="dtos"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<int> InsertRange(int idUser, IEnumerable<TDto> dtos, CancellationToken token);
2024-01-19 17:48:45 +05:00
/// <summary>
/// Редактирование записей
/// </summary>
/// <param name="idUser"></param>
/// <param name="dtos"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<int> UpdateRange(int idUser, IEnumerable<TDto> dtos, CancellationToken token);
2024-01-26 17:23:21 +05:00
/// <summary>
/// Добавляет Dto у которых id == 0, изменяет dto у которых id != 0
/// </summary>
/// <param name="idUser"></param>
/// <param name="dtos"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<int> UpdateOrInsertRange(int idUser, IEnumerable<TDto> dtos, CancellationToken token);
2024-01-26 17:23:21 +05:00
/// <summary>
/// Добавление записей с удалением старых (для импорта)
/// </summary>
/// <param name="idUser"></param>
/// <param name="request"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<int> Clear(int idUser, TRequest request, CancellationToken token);
/// <summary>
/// Очистить и добавить новые
/// </summary>
/// <param name="idUser"></param>
/// <param name="request"></param>
/// <param name="dtos"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<int> ClearAndInsertRange(int idUser, TRequest request, IEnumerable<TDto> dtos, CancellationToken token);
2024-01-26 17:23:21 +05:00
/// <summary>
/// Удаление записей
/// </summary>
/// <param name="idUser"></param>
/// <param name="ids"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<int> DeleteRange(int idUser, IEnumerable<int> ids, CancellationToken token);
/// <summary>
/// Получение дат изменений записей
/// </summary>
/// <param name="request"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<IEnumerable<DateOnly>> GetDatesChange(TRequest request, CancellationToken token);
/// <summary>
/// Получение измененных записей за определенную дату
2024-01-26 17:23:21 +05:00
/// </summary>
/// <param name="request"></param>
/// <param name="date">Фильтр по дате. Если null - вернет все записи, без привязки к дате</param>
2024-01-26 17:23:21 +05:00
/// <param name="token"></param>
/// <returns></returns>
Task<IEnumerable<ChangeLogDto<TDto>>> GetChangeLog(TRequest request, DateOnly? date, CancellationToken token);
2024-01-26 17:23:21 +05:00
/// <summary>
/// Получение записей по параметрам
/// </summary>
/// <param name="request"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<IEnumerable<TDto>> Get(TRequest request, CancellationToken token);
2024-01-19 17:48:45 +05:00
}