2016-12-23 21:45:24 +00:00
|
|
|
|
using NzbDrone.Core.Notifications;
|
2013-05-20 01:32:05 +00:00
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Api.Notifications
|
|
|
|
|
{
|
2014-01-22 05:22:09 +00:00
|
|
|
|
public class NotificationModule : ProviderModuleBase<NotificationResource, INotification, NotificationDefinition>
|
2013-05-20 01:32:05 +00:00
|
|
|
|
{
|
2014-01-22 05:22:09 +00:00
|
|
|
|
public NotificationModule(NotificationFactory notificationFactory)
|
2013-11-21 06:04:15 +00:00
|
|
|
|
: base(notificationFactory, "notification")
|
2013-05-21 06:16:19 +00:00
|
|
|
|
{
|
2013-05-29 02:49:17 +00:00
|
|
|
|
}
|
2013-05-21 06:16:19 +00:00
|
|
|
|
|
2016-03-25 00:56:29 +00:00
|
|
|
|
protected override void MapToResource(NotificationResource resource, NotificationDefinition definition)
|
|
|
|
|
{
|
|
|
|
|
base.MapToResource(resource, definition);
|
2019-12-22 21:24:11 +00:00
|
|
|
|
|
2016-03-25 00:56:29 +00:00
|
|
|
|
resource.OnGrab = definition.OnGrab;
|
|
|
|
|
resource.OnDownload = definition.OnDownload;
|
|
|
|
|
resource.OnUpgrade = definition.OnUpgrade;
|
|
|
|
|
resource.OnRename = definition.OnRename;
|
|
|
|
|
resource.SupportsOnGrab = definition.SupportsOnGrab;
|
|
|
|
|
resource.SupportsOnDownload = definition.SupportsOnDownload;
|
|
|
|
|
resource.SupportsOnUpgrade = definition.SupportsOnUpgrade;
|
|
|
|
|
resource.SupportsOnRename = definition.SupportsOnRename;
|
|
|
|
|
resource.Tags = definition.Tags;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void MapToModel(NotificationDefinition definition, NotificationResource resource)
|
|
|
|
|
{
|
|
|
|
|
base.MapToModel(definition, resource);
|
|
|
|
|
|
|
|
|
|
definition.OnGrab = resource.OnGrab;
|
|
|
|
|
definition.OnDownload = resource.OnDownload;
|
|
|
|
|
definition.OnUpgrade = resource.OnUpgrade;
|
|
|
|
|
definition.OnRename = resource.OnRename;
|
|
|
|
|
definition.SupportsOnGrab = resource.SupportsOnGrab;
|
|
|
|
|
definition.SupportsOnDownload = resource.SupportsOnDownload;
|
|
|
|
|
definition.SupportsOnUpgrade = resource.SupportsOnUpgrade;
|
|
|
|
|
definition.SupportsOnRename = resource.SupportsOnRename;
|
|
|
|
|
definition.Tags = resource.Tags;
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-17 23:43:33 +00:00
|
|
|
|
protected override void Validate(NotificationDefinition definition, bool includeWarnings)
|
2013-05-29 02:49:17 +00:00
|
|
|
|
{
|
2019-12-22 22:08:53 +00:00
|
|
|
|
if (!definition.OnGrab && !definition.OnDownload)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-17 23:43:33 +00:00
|
|
|
|
base.Validate(definition, includeWarnings);
|
2013-05-21 06:16:19 +00:00
|
|
|
|
}
|
2013-05-20 01:32:05 +00:00
|
|
|
|
}
|
2019-12-22 21:24:10 +00:00
|
|
|
|
}
|