1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-26 22:46:53 -04:00

New: Backend changes for new UI

This commit is contained in:
Qstick
2018-11-23 02:03:32 -05:00
parent e9eebd3ce6
commit 65efa15551
485 changed files with 11177 additions and 2233 deletions
+10 -7
View File
@@ -1,15 +1,18 @@
using System;
using System.Linq;
using Nancy;
using NzbDrone.Api.Extensions;
using Radarr.Http.Extensions;
using NzbDrone.Api.Movies;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.Download;
using NzbDrone.Core.History;
using Radarr.Http;
using Radarr.Http.REST;
namespace NzbDrone.Api.History
{
public class HistoryModule : NzbDroneRestModule<HistoryResource>
public class HistoryModule : RadarrRestModule<HistoryResource>
{
private readonly IHistoryService _historyService;
private readonly IQualityUpgradableSpecification _qualityUpgradableSpecification;
@@ -43,19 +46,19 @@ namespace NzbDrone.Api.History
private PagingResource<HistoryResource> GetHistory(PagingResource<HistoryResource> pagingResource)
{
var movieId = Request.Query.MovieId;
var pagingSpec = pagingResource.MapToPagingSpec<HistoryResource, Core.History.History>("date", SortDirection.Descending);
var filter = pagingResource.Filters.FirstOrDefault();
if (pagingResource.FilterKey == "eventType")
if (filter != null && filter.Key == "eventType")
{
var filterValue = (HistoryEventType)Convert.ToInt32(pagingResource.FilterValue);
pagingSpec.FilterExpression = v => v.EventType == filterValue;
var filterValue = (HistoryEventType)Convert.ToInt32(filter.Value);
pagingSpec.FilterExpressions.Add(v => v.EventType == filterValue);
}
if (movieId.HasValue)
{
int i = (int)movieId;
pagingSpec.FilterExpression = h => h.MovieId == i;
pagingSpec.FilterExpressions.Add(h => h.MovieId == i);
}
return ApplyToPage(_historyService.Paged, pagingSpec, MapToResource);