|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using NzbDrone.Core.Applications;
|
|
|
|
|
using NzbDrone.Core.Datastore;
|
|
|
|
|
using NzbDrone.Core.IndexerProxies;
|
|
|
|
|
using NzbDrone.Core.Indexers;
|
|
|
|
@ -28,18 +29,21 @@ namespace NzbDrone.Core.Tags
|
|
|
|
|
private readonly INotificationFactory _notificationFactory;
|
|
|
|
|
private readonly IIndexerFactory _indexerFactory;
|
|
|
|
|
private readonly IIndexerProxyFactory _indexerProxyFactory;
|
|
|
|
|
private readonly IApplicationFactory _applicationFactory;
|
|
|
|
|
|
|
|
|
|
public TagService(ITagRepository repo,
|
|
|
|
|
IEventAggregator eventAggregator,
|
|
|
|
|
INotificationFactory notificationFactory,
|
|
|
|
|
IIndexerFactory indexerFactory,
|
|
|
|
|
IIndexerProxyFactory indexerProxyFactory)
|
|
|
|
|
IIndexerProxyFactory indexerProxyFactory,
|
|
|
|
|
IApplicationFactory applicationFactory)
|
|
|
|
|
{
|
|
|
|
|
_repo = repo;
|
|
|
|
|
_eventAggregator = eventAggregator;
|
|
|
|
|
_notificationFactory = notificationFactory;
|
|
|
|
|
_indexerFactory = indexerFactory;
|
|
|
|
|
_indexerProxyFactory = indexerProxyFactory;
|
|
|
|
|
_applicationFactory = applicationFactory;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Tag GetTag(int tagId)
|
|
|
|
@ -70,6 +74,7 @@ namespace NzbDrone.Core.Tags
|
|
|
|
|
var notifications = _notificationFactory.AllForTag(tagId);
|
|
|
|
|
var indexers = _indexerFactory.AllForTag(tagId);
|
|
|
|
|
var indexerProxies = _indexerProxyFactory.AllForTag(tagId);
|
|
|
|
|
var applications = _applicationFactory.AllForTag(tagId);
|
|
|
|
|
|
|
|
|
|
return new TagDetails
|
|
|
|
|
{
|
|
|
|
@ -77,7 +82,8 @@ namespace NzbDrone.Core.Tags
|
|
|
|
|
Label = tag.Label,
|
|
|
|
|
NotificationIds = notifications.Select(c => c.Id).ToList(),
|
|
|
|
|
IndexerIds = indexers.Select(c => c.Id).ToList(),
|
|
|
|
|
IndexerProxyIds = indexerProxies.Select(c => c.Id).ToList()
|
|
|
|
|
IndexerProxyIds = indexerProxies.Select(c => c.Id).ToList(),
|
|
|
|
|
ApplicationIds = applications.Select(c => c.Id).ToList()
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -87,6 +93,7 @@ namespace NzbDrone.Core.Tags
|
|
|
|
|
var notifications = _notificationFactory.All();
|
|
|
|
|
var indexers = _indexerFactory.All();
|
|
|
|
|
var indexerProxies = _indexerProxyFactory.All();
|
|
|
|
|
var applications = _applicationFactory.All();
|
|
|
|
|
|
|
|
|
|
var details = new List<TagDetails>();
|
|
|
|
|
|
|
|
|
@ -98,7 +105,8 @@ namespace NzbDrone.Core.Tags
|
|
|
|
|
Label = tag.Label,
|
|
|
|
|
NotificationIds = notifications.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList(),
|
|
|
|
|
IndexerIds = indexers.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList(),
|
|
|
|
|
IndexerProxyIds = indexerProxies.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList()
|
|
|
|
|
IndexerProxyIds = indexerProxies.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList(),
|
|
|
|
|
ApplicationIds = applications.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList()
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|