mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 04:11:10 +00:00
Adds the media-neutral library statistics page and separates tags from genres
This commit is contained in:
1 parent
a61fbf407c
commit
00d7eff777
118 files changed
+6132
-1154
No files matched your search
+22
@@ -130,6 +130,28 @@ internal sealed class MediaConsumptionRecordRepository : IMediaConsumptionRecord
|
||||
return Result.Deleted;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes every consumption record of a media item of the user identified by <paramref name="userId"/>.
|
||||
/// </summary>
|
||||
/// <param name="userId">The Id of the user whose consumption records are deleted.</param>
|
||||
/// <param name="mediaKind">The kind of the consumed media item.</param>
|
||||
/// <param name="mediaItemId">The Id of the consumed media item.</param>
|
||||
/// <param name="libraryId">The Id of the media library that contains the media item.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>An <see cref="Result{TValue}"/> representing either a successful deletion, or an error.</returns>
|
||||
public async Task<Result<Deleted>> DeleteAllByMediaItemIdForUserAsync(Guid userId, MediaKind mediaKind, Guid mediaItemId, Guid libraryId, CancellationToken cancellationToken)
|
||||
{
|
||||
List<MediaConsumptionRecordEntity> records = await _luminaDbContext.MediaConsumptionRecords
|
||||
.Where(record => record.UserId == userId &&
|
||||
record.MediaKind == mediaKind &&
|
||||
record.MediaItemId == mediaItemId &&
|
||||
record.LibraryId == libraryId)
|
||||
.ToListAsync(cancellationToken).ConfigureAwait(false);
|
||||
if (records.Count > 0)
|
||||
_luminaDbContext.MediaConsumptionRecords.RemoveRange(records);
|
||||
return Result.Deleted;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes every consumption record of the user identified by <paramref name="userId"/>.
|
||||
/// </summary>
|
||||
|
||||
Reference in new issue
Block a user