WIP: bulkbalk boven de lijst, definitief verwijderen en prullenbak legen, uitsnede direct zonder opslaan, teller per batch
This commit is contained in:
@@ -34,6 +34,9 @@ public interface IHeroRepository
|
||||
/// <summary>Photos that were trashed before the cutoff, tracked (the trash is emptied for them).</summary>
|
||||
Task<IReadOnlyList<HeroImage>> GetTrashedBeforeAsync(DateTimeOffset cutoff, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>True when an image other than the given one has this set hash or this original key (the files are shared).</summary>
|
||||
Task<(bool SetShared, bool OriginalShared)> FilesSharedWithOthersAsync(Guid imageId, string setHash, string originalKey, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>The slides that use an image, tracked (they are removed when the image goes to the trash).</summary>
|
||||
Task<IReadOnlyList<HeroSlide>> GetSlidesOfImageAsync(Guid imageId, CancellationToken cancellationToken);
|
||||
|
||||
@@ -99,6 +102,12 @@ public class HeroRepository(HeroDbContext context) : IHeroRepository
|
||||
public async Task<IReadOnlyList<HeroImage>> GetTrashedBeforeAsync(DateTimeOffset cutoff, CancellationToken cancellationToken)
|
||||
=> (await context.HeroImages.Where(i => i.DeletedAt != null).ToListAsync(cancellationToken)).Where(i => i.DeletedAt < cutoff).ToList();
|
||||
|
||||
public async Task<(bool SetShared, bool OriginalShared)> FilesSharedWithOthersAsync(Guid imageId, string setHash, string originalKey, CancellationToken cancellationToken)
|
||||
{
|
||||
var others = (await context.HeroImages.AsNoTracking().ToListAsync(cancellationToken)).Where(i => i.Id != imageId).ToList();
|
||||
return (setHash.Length > 0 && others.Any(i => i.SetHash == setHash), others.Any(i => i.OriginalKey == originalKey));
|
||||
}
|
||||
|
||||
public async Task<IReadOnlyList<HeroSlide>> GetSlidesOfImageAsync(Guid imageId, CancellationToken cancellationToken)
|
||||
=> await context.HeroSlides.Where(s => s.ImageId == imageId).ToListAsync(cancellationToken);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user