mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 02:26:55 -07:00
Refactored the Notification service to how it should have really been done in the first place.
This commit is contained in:
parent
840deb6161
commit
3fe1f13bd1
17 changed files with 220 additions and 166 deletions
|
@ -26,7 +26,6 @@
|
|||
#endregion
|
||||
using System.Dynamic;
|
||||
using System.Linq;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
using MarkdownSharp;
|
||||
|
||||
|
@ -44,6 +43,7 @@ using PlexRequests.Api.Interfaces;
|
|||
using PlexRequests.Core;
|
||||
using PlexRequests.Core.SettingModels;
|
||||
using PlexRequests.Helpers;
|
||||
using PlexRequests.Services.Interfaces;
|
||||
using PlexRequests.Services.Notification;
|
||||
using PlexRequests.Store.Models;
|
||||
using PlexRequests.Store.Repository;
|
||||
|
@ -69,6 +69,7 @@ namespace PlexRequests.UI.Modules
|
|||
private IPushoverApi PushoverApi { get; }
|
||||
private ICouchPotatoApi CpApi { get; }
|
||||
private IRepository<LogEntity> LogsRepo { get; }
|
||||
private INotificationService NotificationService { get; }
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
public AdminModule(ISettingsService<PlexRequestSettings> rpService,
|
||||
|
@ -85,7 +86,8 @@ namespace PlexRequests.UI.Modules
|
|||
ICouchPotatoApi cpApi,
|
||||
ISettingsService<PushoverNotificationSettings> pushoverSettings,
|
||||
IPushoverApi pushoverApi,
|
||||
IRepository<LogEntity> logsRepo) : base("admin")
|
||||
IRepository<LogEntity> logsRepo,
|
||||
INotificationService notify) : base("admin")
|
||||
{
|
||||
RpService = rpService;
|
||||
CpService = cpService;
|
||||
|
@ -102,6 +104,7 @@ namespace PlexRequests.UI.Modules
|
|||
LogsRepo = logsRepo;
|
||||
PushoverService = pushoverSettings;
|
||||
PushoverApi = pushoverApi;
|
||||
NotificationService = notify;
|
||||
|
||||
#if !DEBUG
|
||||
this.RequiresAuthentication();
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using Humanizer;
|
||||
|
@ -35,9 +34,9 @@ using Nancy;
|
|||
using Nancy.Responses.Negotiation;
|
||||
using Nancy.Security;
|
||||
|
||||
using PlexRequests.Api;
|
||||
using PlexRequests.Core;
|
||||
using PlexRequests.Core.SettingModels;
|
||||
using PlexRequests.Services.Interfaces;
|
||||
using PlexRequests.Services.Notification;
|
||||
using PlexRequests.Store;
|
||||
using PlexRequests.UI.Models;
|
||||
|
@ -47,11 +46,12 @@ namespace PlexRequests.UI.Modules
|
|||
public class RequestsModule : BaseModule
|
||||
{
|
||||
|
||||
public RequestsModule(IRequestService service, ISettingsService<PlexRequestSettings> prSettings, ISettingsService<PlexSettings> plex) : base("requests")
|
||||
public RequestsModule(IRequestService service, ISettingsService<PlexRequestSettings> prSettings, ISettingsService<PlexSettings> plex, INotificationService notify) : base("requests")
|
||||
{
|
||||
Service = service;
|
||||
PrSettings = prSettings;
|
||||
PlexSettings = plex;
|
||||
NotificationService = notify;
|
||||
|
||||
Get["/"] = _ => LoadRequests();
|
||||
Get["/movies"] = _ => GetMovies();
|
||||
|
@ -67,6 +67,7 @@ namespace PlexRequests.UI.Modules
|
|||
}
|
||||
|
||||
private IRequestService Service { get; }
|
||||
private INotificationService NotificationService { get; }
|
||||
private ISettingsService<PlexRequestSettings> PrSettings { get; }
|
||||
private ISettingsService<PlexSettings> PlexSettings { get; }
|
||||
|
||||
|
|
|
@ -53,7 +53,8 @@ namespace PlexRequests.UI.Modules
|
|||
public SearchModule(ICacheProvider cache, ISettingsService<CouchPotatoSettings> cpSettings,
|
||||
ISettingsService<PlexRequestSettings> prSettings, IAvailabilityChecker checker,
|
||||
IRequestService request, ISonarrApi sonarrApi, ISettingsService<SonarrSettings> sonarrSettings,
|
||||
ISettingsService<SickRageSettings> sickRageService, ICouchPotatoApi cpApi, ISickRageApi srApi) : base("search")
|
||||
ISettingsService<SickRageSettings> sickRageService, ICouchPotatoApi cpApi, ISickRageApi srApi,
|
||||
INotificationService notify) : base("search")
|
||||
{
|
||||
CpService = cpSettings;
|
||||
PrService = prSettings;
|
||||
|
@ -67,6 +68,7 @@ namespace PlexRequests.UI.Modules
|
|||
CouchPotatoApi = cpApi;
|
||||
SickRageService = sickRageService;
|
||||
SickrageApi = srApi;
|
||||
NotificationService = notify;
|
||||
|
||||
Get["/"] = parameters => RequestLoad();
|
||||
|
||||
|
@ -80,6 +82,7 @@ namespace PlexRequests.UI.Modules
|
|||
Post["request/tv"] = parameters => RequestTvShow((int)Request.Form.tvId, (bool)Request.Form.latest);
|
||||
}
|
||||
private TheMovieDbApi MovieApi { get; }
|
||||
private INotificationService NotificationService { get; }
|
||||
private ICouchPotatoApi CouchPotatoApi { get; }
|
||||
private ISonarrApi SonarrApi { get; }
|
||||
private TheTvDbApi TvApi { get; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue