forked from ddrilling/AsbCloudServer
164 lines
6.0 KiB
C#
164 lines
6.0 KiB
C#
using AsbCloudApp.Data;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.IO;
|
||
using System.Threading;
|
||
using System.Threading.Tasks;
|
||
|
||
namespace AsbCloudApp.Services
|
||
{
|
||
//TODO: refactor IFileService
|
||
|
||
/// <summary>
|
||
/// Сервис доступа к файлам
|
||
/// </summary>
|
||
public interface IFileService
|
||
{
|
||
/// <summary>
|
||
/// Директория хранения файлов
|
||
/// </summary>
|
||
string RootPath { get; }
|
||
|
||
/// <summary>
|
||
/// Сохранить файл
|
||
/// </summary>
|
||
/// <param name="idWell"></param>
|
||
/// <param name="idUser"></param>
|
||
/// <param name="idCategory"></param>
|
||
/// <param name="fileFullName"></param>
|
||
/// <param name="fileStream"></param>
|
||
/// <param name="token"></param>
|
||
/// <returns></returns>
|
||
Task<FileInfoDto> SaveAsync(int idWell, int? idUser, int idCategory, string fileFullName, Stream fileStream, CancellationToken token = default);
|
||
|
||
/// <summary>
|
||
/// Получить список файлов в контейнере
|
||
/// </summary>
|
||
/// <param name="idWell"></param>
|
||
/// <param name="idCategory"></param>
|
||
/// <param name="companyName"></param>
|
||
/// <param name="fileName"></param>
|
||
/// <param name="begin"></param>
|
||
/// <param name="end"></param>
|
||
/// <param name="skip"></param>
|
||
/// <param name="take"></param>
|
||
/// <param name="token"></param>
|
||
/// <returns></returns>
|
||
Task<PaginationContainer<FileInfoDto>> GetInfosAsync(int idWell,
|
||
int idCategory, string companyName = default, string fileName = default, DateTime begin = default, DateTime end = default,
|
||
int skip = 0, int take = 32, CancellationToken token = default);
|
||
|
||
/// <summary>
|
||
/// Инфо о файле
|
||
/// </summary>
|
||
/// <param name="idFile"></param>
|
||
/// <param name="token"></param>
|
||
/// <returns></returns>
|
||
Task<FileInfoDto> GetInfoAsync(int idFile,
|
||
CancellationToken token);
|
||
|
||
/// <summary>
|
||
/// Пометить файл как удаленный
|
||
/// </summary>
|
||
/// <param name="idFile"></param>
|
||
/// <param name="token"></param>
|
||
/// <returns></returns>
|
||
Task<int> MarkAsDeletedAsync(int idFile,
|
||
CancellationToken token = default);
|
||
|
||
/// <summary>
|
||
/// Получить файлы определенной категории
|
||
/// </summary>
|
||
/// <param name="idWell"></param>
|
||
/// <param name="idCategory"></param>
|
||
/// <param name="token"></param>
|
||
/// <returns></returns>
|
||
Task<IEnumerable<FileInfoDto>> GetInfosByCategoryAsync(int idWell, int idCategory, CancellationToken token = default);
|
||
|
||
/// <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> DeleteAsync(IEnumerable<int> ids, CancellationToken token);
|
||
|
||
/// <summary>
|
||
/// получить путь для скачивания
|
||
/// </summary>
|
||
/// <param name="fileInfo"></param>
|
||
/// <returns></returns>
|
||
string GetUrl(FileInfoDto fileInfo);
|
||
|
||
/// <summary>
|
||
/// получить путь для скачивания
|
||
/// </summary>
|
||
/// <param name="idFile"></param>
|
||
/// <returns></returns>
|
||
string GetUrl(int idFile);
|
||
|
||
/// <summary>
|
||
/// получить путь для скачивания
|
||
/// </summary>
|
||
/// <param name="idWell"></param>
|
||
/// <param name="idCategory"></param>
|
||
/// <param name="idFile"></param>
|
||
/// <param name="dotExtention"></param>
|
||
/// <returns></returns>
|
||
string GetUrl(int idWell, int idCategory, int idFile, string dotExtention);
|
||
|
||
/// <summary>
|
||
/// добавить метку на файл
|
||
/// </summary>
|
||
/// <param name="fileMarkDto"></param>
|
||
/// <param name="idUser"></param>
|
||
/// <param name="token"></param>
|
||
/// <returns></returns>
|
||
Task<int> CreateFileMarkAsync(FileMarkDto fileMarkDto, int idUser, CancellationToken token);
|
||
|
||
/// <summary>
|
||
/// пометить метку файла как удаленную
|
||
/// </summary>
|
||
/// <param name="idMark"></param>
|
||
/// <param name="token"></param>
|
||
/// <returns></returns>
|
||
Task<int> MarkFileMarkAsDeletedAsync(int idMark, CancellationToken token);
|
||
|
||
/// <summary>
|
||
/// переместить файл
|
||
/// </summary>
|
||
/// <param name="idWell"></param>
|
||
/// <param name="idUser"></param>
|
||
/// <param name="idCategory"></param>
|
||
/// <param name="destinationFileName"></param>
|
||
/// <param name="srcFileFullName"></param>
|
||
/// <param name="token"></param>
|
||
/// <returns></returns>
|
||
Task<FileInfoDto> MoveAsync(int idWell, int? idUser, int idCategory, string destinationFileName, string srcFileFullName, CancellationToken token = default);
|
||
|
||
/// <summary>
|
||
/// получить инфо о файле по метке
|
||
/// </summary>
|
||
/// <param name="idMark"></param>
|
||
/// <param name="token"></param>
|
||
/// <returns></returns>
|
||
Task<FileInfoDto> GetByMarkId(int idMark, CancellationToken token);
|
||
|
||
/// <summary>
|
||
/// пометить метки файлов как удаленные
|
||
/// </summary>
|
||
/// <param name="idsMarks"></param>
|
||
/// <param name="token"></param>
|
||
/// <returns></returns>
|
||
Task<int> MarkFileMarkAsDeletedAsync(IEnumerable<int> idsMarks, CancellationToken token);
|
||
}
|
||
}
|