Files
MilkyShots/Lactose/Repositories/IAssetRepository.cs

85 lines
3.0 KiB
C#

using Lactose.Models;
using System.Collections;
namespace Lactose.Repositories;
public interface IAssetRepository : IDisposable {
/// <summary>
/// Finds an asset by its ID.
/// </summary>
/// <param name="id">The ID of the asset.</param>
/// <returns>Null if not found, otherwise the requested asset.</returns>
public Asset? Find(Guid id);
/// <summary>
/// Finds a set of assets by their IDs.
/// </summary>
/// <param name="ids">The IDs of the assets.</param>
/// <returns>A collection of assets with the specified IDs.</returns>
public IEnumerable<Asset> FindBulk(IEnumerable<Guid> ids);
/// <summary>
/// Finds all assets owned by the user.
/// </summary>
/// <param name="ownerId">The ID of the owner.</param>
/// <returns>A collection of assets owned by the specified user.</returns>
public IEnumerable<Asset> FindByOwner(Guid ownerId);
/// <summary>
/// Finds all assets created or updated between the given dates.
/// </summary>
/// <param name="from">The start date of the range.</param>
/// <param name="to">The end date of the range.</param>
/// <returns>A collection of assets created or updated within the specified date range.</returns>
public IEnumerable<Asset> FindByDateRange(DateTime from, DateTime to);
/// <summary>
/// Finds all assets created or updated between the given dates with pagination.
/// </summary>
/// <param name="from">The start date of the range.</param>
/// <param name="to">The end date of the range.</param>
/// <param name="pageNumber">The page number for pagination.</param>
/// <param name="pageSize">The number of items per page.</param>
/// <returns>A collection of assets created or updated within the specified date range.</returns>
public IEnumerable<Asset> FindByDateRange(DateTime from, DateTime to, int pageNumber, int pageSize);
/// <summary>
/// Saves all the changes to the model.
/// </summary>
void Save();
/// <summary>
/// Inserts a new asset.
/// </summary>
/// <param name="asset">The asset to insert.</param>
public void Insert(Asset asset);
/// <summary>
/// Updates a given asset.
/// </summary>
/// <param name="asset">The asset to update.</param>
public void Update(Asset asset);
/// <summary>
/// Updates a list of assets.
/// </summary>
/// <param name="assets">The list of assets to update.</param>
public void UpdateBulk(IEnumerable<Asset> assets);
/// <summary>
/// Gets an asset by its file path.
/// </summary>
/// <param name="filePath">The file path of the asset.</param>
/// <returns>Null if not found, otherwise the requested asset.</returns>
Asset? FindByPath(string filePath);
/// <summary>
/// Finds all assets that are missing a perceptual hash (pHash).
/// </summary>
IEnumerable<Asset> GetAssetsMissingPHash(out int count);
public IEnumerable<Asset> GetWithinHammingDistance(ulong phash, float distance);
IEnumerable<Asset> GetAssetsMissingThumbnail(out int totalAssets);
}