!wip added the api

This commit is contained in:
TidusJar 2018-12-03 21:36:46 +00:00
parent da5d4f0738
commit 75f43260c0
9 changed files with 1253 additions and 9 deletions

View file

@ -18,13 +18,13 @@ namespace Ombi.Core.Tests.Rule.Search
[SetUp] [SetUp]
public void Setup() public void Setup()
{ {
ContextMock = new Mock<IRepository<CouchPotatoCache>>(); ContextMock = new Mock<IExternalRepository<CouchPotatoCache>>();
Rule = new CouchPotatoCacheRule(ContextMock.Object); Rule = new CouchPotatoCacheRule(ContextMock.Object);
} }
private CouchPotatoCacheRule Rule { get; set; } private CouchPotatoCacheRule Rule { get; set; }
private Mock<IRepository<CouchPotatoCache>> ContextMock { get; set; } private Mock<IExternalRepository<CouchPotatoCache>> ContextMock { get; set; }
[Test] [Test]
public async Task Should_ReturnApproved_WhenMovieIsInCouchPotato() public async Task Should_ReturnApproved_WhenMovieIsInCouchPotato()

View file

@ -15,13 +15,13 @@ namespace Ombi.Core.Tests.Rule.Search
[SetUp] [SetUp]
public void Setup() public void Setup()
{ {
ContextMock = new Mock<IRepository<RadarrCache>>(); ContextMock = new Mock<IExternalRepository<RadarrCache>>();
Rule = new RadarrCacheRule(ContextMock.Object); Rule = new RadarrCacheRule(ContextMock.Object);
} }
private RadarrCacheRule Rule { get; set; } private RadarrCacheRule Rule { get; set; }
private Mock<IRepository<RadarrCache>> ContextMock { get; set; } private Mock<IExternalRepository<RadarrCache>> ContextMock { get; set; }
[Test] [Test]
public async Task Should_ReturnApproved_WhenMovieIsInRadarr() public async Task Should_ReturnApproved_WhenMovieIsInRadarr()

View file

@ -22,6 +22,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Ombi.Api.CouchPotato\Ombi.Api.CouchPotato.csproj" /> <ProjectReference Include="..\Ombi.Api.CouchPotato\Ombi.Api.CouchPotato.csproj" />
<ProjectReference Include="..\Ombi.Api.DogNzb\Ombi.Api.DogNzb.csproj" /> <ProjectReference Include="..\Ombi.Api.DogNzb\Ombi.Api.DogNzb.csproj" />
<ProjectReference Include="..\Ombi.Api.Emby\Ombi.Api.Emby.csproj" />
<ProjectReference Include="..\Ombi.Api.Lidarr\Ombi.Api.Lidarr.csproj" /> <ProjectReference Include="..\Ombi.Api.Lidarr\Ombi.Api.Lidarr.csproj" />
<ProjectReference Include="..\Ombi.Api.Plex\Ombi.Api.Plex.csproj" /> <ProjectReference Include="..\Ombi.Api.Plex\Ombi.Api.Plex.csproj" />
<ProjectReference Include="..\Ombi.Api.Radarr\Ombi.Api.Radarr.csproj" /> <ProjectReference Include="..\Ombi.Api.Radarr\Ombi.Api.Radarr.csproj" />

View file

@ -4,14 +4,12 @@ using System.Threading.Tasks;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Ombi.Api.Lidarr; using Ombi.Api.Lidarr;
using Ombi.Api.Lidarr.Models; using Ombi.Api.Lidarr.Models;
using Ombi.Api.Radarr;
using Ombi.Core.Settings; using Ombi.Core.Settings;
using Ombi.Helpers; using Ombi.Helpers;
using Ombi.Settings.Settings.Models.External; using Ombi.Settings.Settings.Models.External;
using Ombi.Store.Entities; using Ombi.Store.Entities;
using Ombi.Store.Entities.Requests; using Ombi.Store.Entities.Requests;
using Ombi.Store.Repository; using Ombi.Store.Repository;
using Serilog;
using ILogger = Microsoft.Extensions.Logging.ILogger; using ILogger = Microsoft.Extensions.Logging.ILogger;
namespace Ombi.Core.Senders namespace Ombi.Core.Senders

View file

@ -1,5 +1,7 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using NUnit.Framework; using NUnit.Framework;
using Ombi.Helpers;
using static Ombi.Schedule.Jobs.Ombi.NewsletterJob; using static Ombi.Schedule.Jobs.Ombi.NewsletterJob;
namespace Ombi.Schedule.Tests namespace Ombi.Schedule.Tests
@ -15,7 +17,7 @@ namespace Ombi.Schedule.Tests
{ {
ep.Add(i); ep.Add(i);
} }
var result = BuildEpisodeList(ep); var result = StringHelper.BuildEpisodeList(ep);
return result; return result;
} }

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,17 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Ombi.Store.Migrations
{
public partial class RequestQueue : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
}
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

View file

@ -14,7 +14,7 @@ namespace Ombi.Store.Migrations
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "2.1.3-rtm-32065"); .HasAnnotation("ProductVersion", "2.1.4-rtm-31024");
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{ {

View file

@ -0,0 +1,44 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Ombi.Store.Entities.Requests;
using Ombi.Store.Repository;
using System.Collections.Generic;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using Ombi.Store.Entities;
namespace Ombi.Controllers
{
[ApiV1]
[Authorize]
[Produces("application/json")]
public class RequestRetyController : Controller
{
public RequestRetyController(IRepository<RequestQueue> requestQueue)
{
_requestQueueRepository = requestQueue;
}
private readonly IRepository<RequestQueue> _requestQueueRepository;
/// <summary>
/// Get's all the failed requests that are currently in the queue
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<IEnumerable<RequestQueue>> Categories()
{
return await _requestQueueRepository.GetAll().Where(x => !x.Completed.HasValue).ToListAsync();
}
[HttpDelete("{queueId:int}")]
public async Task<IActionResult> Delete(int queueId)
{
var queueItem = await _requestQueueRepository.GetAll().FirstOrDefaultAsync(x => x.Id == queueId);
await _requestQueueRepository.Delete(queueItem);
return Ok();
}
}
}