added deletion of items

This commit is contained in:
2026-04-13 14:58:10 -04:00
parent 8ff4fa74e4
commit a6e2156d97
7 changed files with 139 additions and 31 deletions
+17
View File
@@ -133,6 +133,23 @@ public class AobaService(IMongoDatabase db)
}
}
public async Task DeleteFilesAsync(IEnumerable<ObjectId> mediaIds, CancellationToken cancellationToken = default)
{
foreach (var id in mediaIds)
{
try
{
cancellationToken.ThrowIfCancellationRequested();
await _gridFs.DeleteAsync(id, CancellationToken.None);
await _media.DeleteOneAsync(m => m.MediaId == id, CancellationToken.None);
}
catch (GridFSFileNotFoundException)
{
//ignore if file was not found
}
}
}
public async Task DeriveTagsAsync(CancellationToken cancellationToken = default)