50 lines
1.3 KiB
C#
50 lines
1.3 KiB
C#
using Lagerbestand.Models;
|
|
|
|
namespace Lagerbestand.Services;
|
|
|
|
/// <summary>
|
|
/// Service interface for file storage operations (disk/NFS based)
|
|
/// </summary>
|
|
public interface IFileStorageService
|
|
{
|
|
/// <summary>
|
|
/// Gets the current storage settings
|
|
/// </summary>
|
|
Task<FileStorageSettings> GetSettingsAsync();
|
|
|
|
/// <summary>
|
|
/// Updates the storage settings
|
|
/// </summary>
|
|
Task SaveSettingsAsync(FileStorageSettings settings);
|
|
|
|
/// <summary>
|
|
/// Validates if the storage path is accessible and writable
|
|
/// </summary>
|
|
Task<(bool IsValid, string? ErrorMessage)> ValidateStoragePathAsync(string path);
|
|
|
|
/// <summary>
|
|
/// Saves a file to storage and returns the relative path
|
|
/// </summary>
|
|
Task<string> SaveFileAsync(byte[] content, string fileName, string subDirectory = "attachments");
|
|
|
|
/// <summary>
|
|
/// Reads a file from storage
|
|
/// </summary>
|
|
Task<byte[]?> ReadFileAsync(string relativePath);
|
|
|
|
/// <summary>
|
|
/// Deletes a file from storage
|
|
/// </summary>
|
|
Task<bool> DeleteFileAsync(string relativePath);
|
|
|
|
/// <summary>
|
|
/// Checks if a file exists in storage
|
|
/// </summary>
|
|
Task<bool> FileExistsAsync(string relativePath);
|
|
|
|
/// <summary>
|
|
/// Gets the file size in bytes
|
|
/// </summary>
|
|
Task<long> GetFileSizeAsync(string relativePath);
|
|
}
|