2024-07-04 11:02:45 +05:00
|
|
|
|
using AsbCloudApp.Data;
|
2024-05-23 14:25:37 +05:00
|
|
|
|
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-06-05 12:08:38 +05:00
|
|
|
|
public interface IChangeLogRepository<TDto, TRequest>
|
2024-05-31 15:58:28 +05:00
|
|
|
|
where TDto : IId
|
2024-01-19 17:48:45 +05:00
|
|
|
|
{
|
2024-05-23 14:25:37 +05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Добавление записей
|
|
|
|
|
/// </summary>
|
2024-05-31 11:53:58 +05:00
|
|
|
|
/// <param name="idUser">пользователь, который добавляет</param>
|
2024-05-23 14:25:37 +05:00
|
|
|
|
/// <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
|
|
|
|
|
2024-05-23 14:25:37 +05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Редактирование записей
|
|
|
|
|
/// </summary>
|
2024-05-31 11:53:58 +05:00
|
|
|
|
/// <param name="idUser">пользователь, который редактирует</param>
|
2024-05-23 14:25:37 +05:00
|
|
|
|
/// <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
|
|
|
|
|
2024-01-29 12:25:58 +05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Добавляет Dto у которых id == 0, изменяет dto у которых id != 0
|
|
|
|
|
/// </summary>
|
2024-05-31 11:53:58 +05:00
|
|
|
|
/// <param name="idUser">пользователь, который редактирует или добавляет</param>
|
2024-01-29 12:25:58 +05:00
|
|
|
|
/// <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>
|
2024-05-31 11:53:58 +05:00
|
|
|
|
/// Помечает записи как удаленные
|
2024-01-26 17:23:21 +05:00
|
|
|
|
/// </summary>
|
2024-05-31 11:53:58 +05:00
|
|
|
|
/// <param name="idUser">пользователь, который чистит</param>
|
|
|
|
|
/// <param name="request">Фильтр по свойствам конкретной сущности</param>
|
2024-01-26 17:23:21 +05:00
|
|
|
|
/// <param name="token"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
Task<int> Clear(int idUser, TRequest request, CancellationToken token);
|
|
|
|
|
|
2024-01-29 12:25:58 +05:00
|
|
|
|
/// <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>
|
2024-05-31 13:37:48 +05:00
|
|
|
|
/// Пометить записи как удаленные
|
2024-01-26 17:23:21 +05:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="idUser"></param>
|
|
|
|
|
/// <param name="ids"></param>
|
|
|
|
|
/// <param name="token"></param>
|
|
|
|
|
/// <returns></returns>
|
2024-05-31 13:37:48 +05:00
|
|
|
|
Task<int> MarkAsDeleted(int idUser, IEnumerable<int> ids, CancellationToken token);
|
2024-01-26 17:23:21 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Получение дат изменений записей
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
/// <param name="token"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
Task<IEnumerable<DateOnly>> GetDatesChange(TRequest request, CancellationToken token);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2024-05-28 00:05:21 +05:00
|
|
|
|
/// Получение измененных записей за определенную дату
|
2024-01-26 17:23:21 +05:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="request"></param>
|
2024-05-28 00:05:21 +05:00
|
|
|
|
/// <param name="date">Фильтр по дате. Если null - вернет все записи, без привязки к дате</param>
|
2024-01-26 17:23:21 +05:00
|
|
|
|
/// <param name="token"></param>
|
|
|
|
|
/// <returns></returns>
|
2024-05-31 15:58:28 +05:00
|
|
|
|
Task<IEnumerable<ChangeLogDto<TDto>>> GetChangeLogForDate(TRequest request, DateOnly? date, CancellationToken token);
|
2024-01-26 17:23:21 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2024-05-31 11:53:58 +05:00
|
|
|
|
/// Получение текущих сейчас записей по параметрам
|
2024-01-26 17:23:21 +05:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
/// <param name="token"></param>
|
|
|
|
|
/// <returns></returns>
|
2024-05-31 11:53:58 +05:00
|
|
|
|
Task<IEnumerable<TDto>> GetCurrent(TRequest request, CancellationToken token);
|
2024-06-05 12:08:38 +05:00
|
|
|
|
|
2024-05-31 15:58:28 +05:00
|
|
|
|
/// <summary>
|
2024-06-04 16:55:44 +05:00
|
|
|
|
/// Получение объекта, реализующего интерфейс IChangeLogRepositoryBuilder
|
|
|
|
|
/// для последующих вызовов методов фильтрации по запросам
|
2024-05-31 15:58:28 +05:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
2024-06-05 15:52:40 +05:00
|
|
|
|
IChangeLogQueryBuilder<TDto, TRequest> GetQueryBuilder(ChangeLogRequest request);
|
2024-01-19 17:48:45 +05:00
|
|
|
|
}
|