1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-21 22:05:43 -04:00

New: Bulk manage custom formats

This commit is contained in:
Bogdan
2024-08-19 02:55:13 +03:00
parent 672b351497
commit da5323a08f
25 changed files with 691 additions and 24 deletions
@@ -9,10 +9,12 @@ namespace NzbDrone.Core.CustomFormats
public interface ICustomFormatService
{
void Update(CustomFormat customFormat);
void Update(List<CustomFormat> customFormat);
CustomFormat Insert(CustomFormat customFormat);
List<CustomFormat> All();
CustomFormat GetById(int id);
void Delete(int id);
void Delete(List<int> ids);
}
public class CustomFormatService : ICustomFormatService
@@ -51,6 +53,12 @@ namespace NzbDrone.Core.CustomFormats
_cache.Clear();
}
public void Update(List<CustomFormat> customFormat)
{
_formatRepository.UpdateMany(customFormat);
_cache.Clear();
}
public CustomFormat Insert(CustomFormat customFormat)
{
// Add to DB then insert into profiles
@@ -72,5 +80,20 @@ namespace NzbDrone.Core.CustomFormats
_formatRepository.Delete(id);
_cache.Clear();
}
public void Delete(List<int> ids)
{
foreach (var id in ids)
{
var format = _formatRepository.Get(id);
// Remove from profiles before removing from DB
_eventAggregator.PublishEvent(new CustomFormatDeletedEvent(format));
_formatRepository.Delete(id);
}
_cache.Clear();
}
}
}