Allow deleting Scrobble events

This commit is contained in:
Amelia 2025-06-19 22:05:08 +02:00
parent 1a4aa215d6
commit 169d819de5
No known key found for this signature in database
GPG key ID: D6D0ECE365407EAA
10 changed files with 160 additions and 11 deletions

View file

@ -254,7 +254,7 @@ public class ScrobblingController : BaseApiController
}
/// <summary>
/// Adds a hold against the Series for user's scrobbling
/// Remove a hold against the Series for user's scrobbling
/// </summary>
/// <param name="seriesId"></param>
/// <returns></returns>
@ -281,4 +281,18 @@ public class ScrobblingController : BaseApiController
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(User.GetUserId());
return Ok(user is {HasRunScrobbleEventGeneration: true});
}
/// <summary>
/// Delete the given scrobble events if they belong to that user
/// </summary>
/// <param name="eventIds"></param>
/// <returns></returns>
[HttpPost("bulk-remove-events")]
public async Task<ActionResult> BulkRemoveScrobbleEvents(IList<long> eventIds)
{
var events = await _unitOfWork.ScrobbleRepository.GetUserEvents(User.GetUserId(), eventIds);
_unitOfWork.ScrobbleRepository.Remove(events);
await _unitOfWork.CommitAsync();
return Ok();
}
}