mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-13 16:52:56 -07:00
Fixed build !wip
This commit is contained in:
parent
c8415f8da9
commit
ee89f6f16c
4 changed files with 13 additions and 9 deletions
|
@ -1,4 +1,5 @@
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Ombi.Core.Models.Search;
|
using Ombi.Core.Models.Search;
|
||||||
|
@ -14,7 +15,7 @@ namespace Ombi.Core.Tests.Rule.Search
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
ContextMock = new Mock<IPlexContentRepository>();
|
ContextMock = new Mock<IPlexContentRepository>();
|
||||||
Rule = new PlexAvailabilityRule(ContextMock.Object);
|
Rule = new PlexAvailabilityRule(ContextMock.Object, new Mock<ILogger<PlexAvailabilityRule>>().Object);
|
||||||
}
|
}
|
||||||
|
|
||||||
private PlexAvailabilityRule Rule { get; set; }
|
private PlexAvailabilityRule Rule { get; set; }
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using Ombi.Core.Models.Search;
|
using Ombi.Core.Models.Search;
|
||||||
using Ombi.Core.Rule.Interfaces;
|
using Ombi.Core.Rule.Interfaces;
|
||||||
using Ombi.Helpers;
|
using Ombi.Helpers;
|
||||||
|
@ -10,12 +11,14 @@ namespace Ombi.Core.Rule.Rules.Search
|
||||||
{
|
{
|
||||||
public class PlexAvailabilityRule : BaseSearchRule, IRules<SearchViewModel>
|
public class PlexAvailabilityRule : BaseSearchRule, IRules<SearchViewModel>
|
||||||
{
|
{
|
||||||
public PlexAvailabilityRule(IPlexContentRepository repo)
|
public PlexAvailabilityRule(IPlexContentRepository repo, ILogger<PlexAvailabilityRule> log)
|
||||||
{
|
{
|
||||||
PlexContentRepository = repo;
|
PlexContentRepository = repo;
|
||||||
|
Log = log;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IPlexContentRepository PlexContentRepository { get; }
|
private IPlexContentRepository PlexContentRepository { get; }
|
||||||
|
private ILogger Log { get; }
|
||||||
|
|
||||||
public async Task<RuleResult> Execute(SearchViewModel obj)
|
public async Task<RuleResult> Execute(SearchViewModel obj)
|
||||||
{
|
{
|
||||||
|
@ -72,7 +75,7 @@ namespace Ombi.Core.Rule.Rules.Search
|
||||||
{
|
{
|
||||||
foreach (var episode in season.Episodes)
|
foreach (var episode in season.Episodes)
|
||||||
{
|
{
|
||||||
await AvailabilityRuleHelper.SingleEpisodeCheck(useImdb, allEpisodes, episode, season, item, useTheMovieDb, useTvDb);
|
await AvailabilityRuleHelper.SingleEpisodeCheck(useImdb, allEpisodes, episode, season, item, useTheMovieDb, useTvDb, Log);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,27 +40,27 @@ namespace Ombi.Store.Repository
|
||||||
_db.AddRange(content);
|
_db.AddRange(content);
|
||||||
if (save)
|
if (save)
|
||||||
{
|
{
|
||||||
await _ctx.SaveChangesAsync();
|
await SaveChangesAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<T> Add(T content)
|
public async Task<T> Add(T content)
|
||||||
{
|
{
|
||||||
await _db.AddAsync(content);
|
await _db.AddAsync(content);
|
||||||
await _ctx.SaveChangesAsync();
|
await SaveChangesAsync();
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task Delete(T request)
|
public async Task Delete(T request)
|
||||||
{
|
{
|
||||||
_db.Remove(request);
|
_db.Remove(request);
|
||||||
await _ctx.SaveChangesAsync();
|
await SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteRange(IEnumerable<T> req)
|
public async Task DeleteRange(IEnumerable<T> req)
|
||||||
{
|
{
|
||||||
_db.RemoveRange(req);
|
_db.RemoveRange(req);
|
||||||
await _ctx.SaveChangesAsync();
|
await SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> SaveChangesAsync()
|
public async Task<int> SaveChangesAsync()
|
||||||
|
@ -79,7 +79,7 @@ namespace Ombi.Store.Repository
|
||||||
{
|
{
|
||||||
await _ctx.Database.ExecuteSqlCommandAsync(sql);
|
await _ctx.Database.ExecuteSqlCommandAsync(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private bool _disposed;
|
private bool _disposed;
|
||||||
// Protected implementation of Dispose pattern.
|
// Protected implementation of Dispose pattern.
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AutoMapper" Version="6.1.1" />
|
<PackageReference Include="AutoMapper" Version="6.1.1" />
|
||||||
<PackageReference Include="CommandLineParser" Version="2.1.1-beta" />
|
<PackageReference Include="CommandLineParser" Version="2.1.1-beta" />
|
||||||
<PackageReference Include="Hangfire.AspNetCore" Version="1.6.21" />
|
<PackageReference Include="Hangfire.AspNetCore" Version="1.6.22" />
|
||||||
<PackageReference Include="Hangfire.Console" Version="1.3.10" />
|
<PackageReference Include="Hangfire.Console" Version="1.3.10" />
|
||||||
<PackageReference Include="Hangfire.MemoryStorage.Core" Version="1.4.0" />
|
<PackageReference Include="Hangfire.MemoryStorage.Core" Version="1.4.0" />
|
||||||
<PackageReference Include="Hangfire.RecurringJobExtensions" Version="1.1.6" />
|
<PackageReference Include="Hangfire.RecurringJobExtensions" Version="1.1.6" />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue