mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-16 02:02:55 -07:00
!wip added the api
This commit is contained in:
parent
da5d4f0738
commit
75f43260c0
9 changed files with 1253 additions and 9 deletions
|
@ -18,13 +18,13 @@ namespace Ombi.Core.Tests.Rule.Search
|
|||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
ContextMock = new Mock<IRepository<CouchPotatoCache>>();
|
||||
ContextMock = new Mock<IExternalRepository<CouchPotatoCache>>();
|
||||
Rule = new CouchPotatoCacheRule(ContextMock.Object);
|
||||
|
||||
}
|
||||
|
||||
private CouchPotatoCacheRule Rule { get; set; }
|
||||
private Mock<IRepository<CouchPotatoCache>> ContextMock { get; set; }
|
||||
private Mock<IExternalRepository<CouchPotatoCache>> ContextMock { get; set; }
|
||||
|
||||
[Test]
|
||||
public async Task Should_ReturnApproved_WhenMovieIsInCouchPotato()
|
||||
|
|
|
@ -15,13 +15,13 @@ namespace Ombi.Core.Tests.Rule.Search
|
|||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
ContextMock = new Mock<IRepository<RadarrCache>>();
|
||||
ContextMock = new Mock<IExternalRepository<RadarrCache>>();
|
||||
Rule = new RadarrCacheRule(ContextMock.Object);
|
||||
|
||||
}
|
||||
|
||||
private RadarrCacheRule Rule { get; set; }
|
||||
private Mock<IRepository<RadarrCache>> ContextMock { get; set; }
|
||||
private Mock<IExternalRepository<RadarrCache>> ContextMock { get; set; }
|
||||
|
||||
[Test]
|
||||
public async Task Should_ReturnApproved_WhenMovieIsInRadarr()
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
<ItemGroup>
|
||||
<ProjectReference Include="..\Ombi.Api.CouchPotato\Ombi.Api.CouchPotato.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.Plex\Ombi.Api.Plex.csproj" />
|
||||
<ProjectReference Include="..\Ombi.Api.Radarr\Ombi.Api.Radarr.csproj" />
|
||||
|
|
|
@ -4,14 +4,12 @@ using System.Threading.Tasks;
|
|||
using Microsoft.Extensions.Logging;
|
||||
using Ombi.Api.Lidarr;
|
||||
using Ombi.Api.Lidarr.Models;
|
||||
using Ombi.Api.Radarr;
|
||||
using Ombi.Core.Settings;
|
||||
using Ombi.Helpers;
|
||||
using Ombi.Settings.Settings.Models.External;
|
||||
using Ombi.Store.Entities;
|
||||
using Ombi.Store.Entities.Requests;
|
||||
using Ombi.Store.Repository;
|
||||
using Serilog;
|
||||
using ILogger = Microsoft.Extensions.Logging.ILogger;
|
||||
|
||||
namespace Ombi.Core.Senders
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using Ombi.Helpers;
|
||||
using static Ombi.Schedule.Jobs.Ombi.NewsletterJob;
|
||||
|
||||
namespace Ombi.Schedule.Tests
|
||||
|
@ -15,7 +17,7 @@ namespace Ombi.Schedule.Tests
|
|||
{
|
||||
ep.Add(i);
|
||||
}
|
||||
var result = BuildEpisodeList(ep);
|
||||
var result = StringHelper.BuildEpisodeList(ep);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
1182
src/Ombi.Store/Migrations/20181203213532_RequestQueue.Designer.cs
generated
Normal file
1182
src/Ombi.Store/Migrations/20181203213532_RequestQueue.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
17
src/Ombi.Store/Migrations/20181203213532_RequestQueue.cs
Normal file
17
src/Ombi.Store/Migrations/20181203213532_RequestQueue.cs
Normal 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)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,7 +14,7 @@ namespace Ombi.Store.Migrations
|
|||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "2.1.3-rtm-32065");
|
||||
.HasAnnotation("ProductVersion", "2.1.4-rtm-31024");
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
|
||||
{
|
||||
|
|
44
src/Ombi/Controllers/RequestRetyController.cs
Normal file
44
src/Ombi/Controllers/RequestRetyController.cs
Normal 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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue