Fixed build

pull/4185/head v4.0.1353
tidusjar 3 years ago
parent 64c0fc17cc
commit 6e32bd33f5

@ -30,7 +30,7 @@ namespace Ombi.Core.Tests.Rule.Search
public async Task Should_Not_Be_Monitored_Or_Available() public async Task Should_Not_Be_Monitored_Or_Available()
{ {
var request = new SearchAlbumViewModel { ForeignAlbumId = "abc" }; var request = new SearchAlbumViewModel { ForeignAlbumId = "abc" };
var result = await Rule.Execute(request); var result = await Rule.Execute(request, string.Empty);
Assert.True(result.Success); Assert.True(result.Success);
Assert.False(request.Approved); Assert.False(request.Approved);
@ -49,7 +49,7 @@ namespace Ombi.Core.Tests.Rule.Search
} }
}.AsQueryable()); }.AsQueryable());
var request = new SearchAlbumViewModel { ForeignAlbumId = "abc" }; var request = new SearchAlbumViewModel { ForeignAlbumId = "abc" };
var result = await Rule.Execute(request); var result = await Rule.Execute(request, string.Empty);
Assert.True(result.Success); Assert.True(result.Success);
Assert.False(request.Approved); Assert.False(request.Approved);
@ -71,7 +71,7 @@ namespace Ombi.Core.Tests.Rule.Search
} }
}.AsQueryable()); }.AsQueryable());
var request = new SearchAlbumViewModel { ForeignAlbumId = "abc" }; var request = new SearchAlbumViewModel { ForeignAlbumId = "abc" };
var result = await Rule.Execute(request); var result = await Rule.Execute(request, string.Empty);
Assert.True(result.Success); Assert.True(result.Success);
Assert.False(request.Approved); Assert.False(request.Approved);
@ -93,7 +93,7 @@ namespace Ombi.Core.Tests.Rule.Search
} }
}.AsQueryable()); }.AsQueryable());
var request = new SearchAlbumViewModel { ForeignAlbumId = "abc" }; var request = new SearchAlbumViewModel { ForeignAlbumId = "abc" };
var result = await Rule.Execute(request); var result = await Rule.Execute(request, string.Empty);
Assert.True(result.Success); Assert.True(result.Success);
Assert.False(request.Approved); Assert.False(request.Approved);
@ -114,7 +114,7 @@ namespace Ombi.Core.Tests.Rule.Search
} }
}.AsQueryable()); }.AsQueryable());
var request = new SearchAlbumViewModel { ForeignAlbumId = "abc" }; var request = new SearchAlbumViewModel { ForeignAlbumId = "abc" };
var result = await Rule.Execute(request); var result = await Rule.Execute(request, string.Empty);
Assert.True(result.Success); Assert.True(result.Success);
Assert.False(request.Approved); Assert.False(request.Approved);

@ -29,7 +29,7 @@ namespace Ombi.Core.Tests.Rule.Search
public async Task Should_Not_Be_Monitored() public async Task Should_Not_Be_Monitored()
{ {
var request = new SearchArtistViewModel { ForignArtistId = "abc" }; var request = new SearchArtistViewModel { ForignArtistId = "abc" };
var result = await Rule.Execute(request); var result = await Rule.Execute(request, string.Empty);
Assert.True(result.Success); Assert.True(result.Success);
Assert.False(request.Monitored); Assert.False(request.Monitored);
@ -46,7 +46,7 @@ namespace Ombi.Core.Tests.Rule.Search
} }
}.AsQueryable()); }.AsQueryable());
var request = new SearchArtistViewModel { ForignArtistId = "abc" }; var request = new SearchArtistViewModel { ForignArtistId = "abc" };
var result = await Rule.Execute(request); var result = await Rule.Execute(request, string.Empty);
Assert.True(result.Success); Assert.True(result.Success);
Assert.True(request.Monitored); Assert.True(request.Monitored);
@ -64,7 +64,7 @@ namespace Ombi.Core.Tests.Rule.Search
} }
}.AsQueryable()); }.AsQueryable());
var request = new SearchArtistViewModel { ForignArtistId = "abc" }; var request = new SearchArtistViewModel { ForignArtistId = "abc" };
var result = await Rule.Execute(request); var result = await Rule.Execute(request, string.Empty);
Assert.True(result.Success); Assert.True(result.Success);
Assert.True(request.Monitored); Assert.True(request.Monitored);

@ -550,7 +550,7 @@ namespace Ombi.Core.Engine
request.Denied = false; request.Denied = false;
await MovieRepository.Update(request); await MovieRepository.Update(request);
var canNotify = await RunSpecificRule(request, SpecificRules.CanSendNotification); var canNotify = await RunSpecificRule(request, SpecificRules.CanSendNotification, string.Empty);
if (canNotify.Success) if (canNotify.Success)
{ {
await NotificationHelper.Notify(request, NotificationType.RequestApproved); await NotificationHelper.Notify(request, NotificationType.RequestApproved);

@ -362,7 +362,7 @@ namespace Ombi.Core.Engine
await MusicRepository.Update(request); await MusicRepository.Update(request);
var canNotify = await RunSpecificRule(request, SpecificRules.CanSendNotification); var canNotify = await RunSpecificRule(request, SpecificRules.CanSendNotification, string.Empty);
if (canNotify.Success) if (canNotify.Success)
{ {
await NotificationHelper.Notify(request, NotificationType.RequestApproved); await NotificationHelper.Notify(request, NotificationType.RequestApproved);
@ -506,7 +506,7 @@ namespace Ombi.Core.Engine
{ {
await MusicRepository.Add(model); await MusicRepository.Add(model);
var result = await RunSpecificRule(model, SpecificRules.CanSendNotification); var result = await RunSpecificRule(model, SpecificRules.CanSendNotification, string.Empty);
if (result.Success) if (result.Success)
{ {
await NotificationHelper.NewRequest(model); await NotificationHelper.NewRequest(model);

@ -151,7 +151,7 @@ namespace Ombi.Core.Engine
} }
await Rules.StartSpecificRules(vm, SpecificRules.LidarrArtist); await Rules.StartSpecificRules(vm, SpecificRules.LidarrArtist, string.Empty);
return vm; return vm;
} }
@ -190,7 +190,7 @@ namespace Ombi.Core.Engine
vm.Cover = a.images?.FirstOrDefault(x => x.coverType.Equals("cover"))?.url?.ToHttpsUrl(); vm.Cover = a.images?.FirstOrDefault(x => x.coverType.Equals("cover"))?.url?.ToHttpsUrl();
await Rules.StartSpecificRules(vm, SpecificRules.LidarrAlbum); await Rules.StartSpecificRules(vm, SpecificRules.LidarrAlbum, string.Empty);
await RunSearchRules(vm); await RunSearchRules(vm);
@ -230,7 +230,7 @@ namespace Ombi.Core.Engine
vm.Cover = a.remoteCover; vm.Cover = a.remoteCover;
} }
await Rules.StartSpecificRules(vm, SpecificRules.LidarrAlbum); await Rules.StartSpecificRules(vm, SpecificRules.LidarrAlbum, string.Empty);
await RunSearchRules(vm); await RunSearchRules(vm);
@ -258,7 +258,7 @@ namespace Ombi.Core.Engine
vm.Cover = fullAlbum.remoteCover; vm.Cover = fullAlbum.remoteCover;
} }
await Rules.StartSpecificRules(vm, SpecificRules.LidarrAlbum); await Rules.StartSpecificRules(vm, SpecificRules.LidarrAlbum, string.Empty);
await RunSearchRules(vm); await RunSearchRules(vm);

@ -915,7 +915,7 @@ namespace Ombi.Core.Engine
private async Task<RequestEngineResult> AfterRequest(ChildRequests model, string requestOnBehalf) private async Task<RequestEngineResult> AfterRequest(ChildRequests model, string requestOnBehalf)
{ {
var sendRuleResult = await RunSpecificRule(model, SpecificRules.CanSendNotification); var sendRuleResult = await RunSpecificRule(model, SpecificRules.CanSendNotification, requestOnBehalf);
if (sendRuleResult.Success) if (sendRuleResult.Success)
{ {
await NotificationHelper.NewRequest(model); await NotificationHelper.NewRequest(model);

@ -9,7 +9,7 @@ using Ombi.Store.Repository;
namespace Ombi.Core.Rule.Rules.Search namespace Ombi.Core.Rule.Rules.Search
{ {
public class LidarrAlbumCacheRule : BaseSearchRule, IRules<SearchViewModel> public class LidarrAlbumCacheRule : SpecificRule, ISpecificRule<object>
{ {
public LidarrAlbumCacheRule(IExternalRepository<LidarrAlbumCache> db) public LidarrAlbumCacheRule(IExternalRepository<LidarrAlbumCache> db)
{ {
@ -18,7 +18,9 @@ namespace Ombi.Core.Rule.Rules.Search
private readonly IExternalRepository<LidarrAlbumCache> _db; private readonly IExternalRepository<LidarrAlbumCache> _db;
public Task<RuleResult> Execute(SearchViewModel objec) public override SpecificRules Rule => SpecificRules.LidarrAlbum;
public Task<RuleResult> Execute(object objec, string requestOnBehalf)
{ {
if (objec is SearchAlbumViewModel obj) if (objec is SearchAlbumViewModel obj)
{ {

@ -8,7 +8,7 @@ using Ombi.Store.Repository;
namespace Ombi.Core.Rule.Rules.Search namespace Ombi.Core.Rule.Rules.Search
{ {
public class LidarrArtistCacheRule : SpecificRule, IRules<object> public class LidarrArtistCacheRule : SpecificRule, ISpecificRule<object>
{ {
public LidarrArtistCacheRule(IExternalRepository<LidarrArtistCache> db) public LidarrArtistCacheRule(IExternalRepository<LidarrArtistCache> db)
{ {
@ -17,7 +17,7 @@ namespace Ombi.Core.Rule.Rules.Search
private readonly IExternalRepository<LidarrArtistCache> _db; private readonly IExternalRepository<LidarrArtistCache> _db;
public Task<RuleResult> Execute(object objec) public Task<RuleResult> Execute(object objec, string requestOnBehalf)
{ {
var obj = (SearchArtistViewModel) objec; var obj = (SearchArtistViewModel) objec;
// Check if it's in Lidarr // Check if it's in Lidarr

Loading…
Cancel
Save