mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 13:33:34 -07:00
New: Bulk remove from Blacklist
This commit is contained in:
parent
4a9d870720
commit
d7183f999c
9 changed files with 218 additions and 12 deletions
9
src/Lidarr.Api.V1/Blacklist/BlacklistBulkResource.cs
Normal file
9
src/Lidarr.Api.V1/Blacklist/BlacklistBulkResource.cs
Normal file
|
@ -0,0 +1,9 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace Lidarr.Api.V1.Blacklist
|
||||
{
|
||||
public class BlacklistBulkResource
|
||||
{
|
||||
public List<int> Ids { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
using Lidarr.Http;
|
||||
using Lidarr.Http.Extensions;
|
||||
using NzbDrone.Core.Blacklisting;
|
||||
using NzbDrone.Core.Datastore;
|
||||
|
||||
|
@ -13,6 +14,8 @@ namespace Lidarr.Api.V1.Blacklist
|
|||
_blacklistService = blacklistService;
|
||||
GetResourcePaged = GetBlacklist;
|
||||
DeleteResource = DeleteBlacklist;
|
||||
|
||||
Delete("/bulk", x => Remove());
|
||||
}
|
||||
|
||||
private PagingResource<BlacklistResource> GetBlacklist(PagingResource<BlacklistResource> pagingResource)
|
||||
|
@ -26,5 +29,14 @@ namespace Lidarr.Api.V1.Blacklist
|
|||
{
|
||||
_blacklistService.Delete(id);
|
||||
}
|
||||
|
||||
private object Remove()
|
||||
{
|
||||
var resource = Request.Body.FromJson<BlacklistBulkResource>();
|
||||
|
||||
_blacklistService.Delete(resource.Ids);
|
||||
|
||||
return new object();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace NzbDrone.Core.Blacklisting
|
|||
bool Blacklisted(int artistId, ReleaseInfo release);
|
||||
PagingSpec<Blacklist> Paged(PagingSpec<Blacklist> pagingSpec);
|
||||
void Delete(int id);
|
||||
void Delete(List<int> ids);
|
||||
}
|
||||
|
||||
public class BlacklistService : IBlacklistService,
|
||||
|
@ -70,6 +71,11 @@ namespace NzbDrone.Core.Blacklisting
|
|||
_blacklistRepository.Delete(id);
|
||||
}
|
||||
|
||||
public void Delete(List<int> ids)
|
||||
{
|
||||
_blacklistRepository.DeleteMany(ids);
|
||||
}
|
||||
|
||||
private bool SameNzb(Blacklist item, ReleaseInfo release)
|
||||
{
|
||||
if (item.PublishedDate == release.PublishDate)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue