You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Prowlarr/src/NzbDrone.Api/History/HistoryModule.cs

40 lines
1.3 KiB

using System;
using System.Collections.Generic;
using NzbDrone.Api.Mapping;
using NzbDrone.Core.Datastore;
12 years ago
using NzbDrone.Core.History;
namespace NzbDrone.Api.History
{
public class HistoryModule : NzbDroneRestModule<HistoryResource>
12 years ago
{
private readonly IHistoryService _historyService;
public HistoryModule(IHistoryService historyService)
{
_historyService = historyService;
GetResourcePaged = GetHistory;
12 years ago
}
private PagingResource<HistoryResource> GetHistory(PagingResource<HistoryResource> pagingResource)
12 years ago
{
var episodeId = Request.Query.EpisodeId;
12 years ago
var pagingSpec = new PagingSpec<Core.History.History>
12 years ago
{
Page = pagingResource.Page,
PageSize = pagingResource.PageSize,
SortKey = pagingResource.SortKey,
SortDirection = pagingResource.SortDirection
12 years ago
};
if (episodeId.HasValue)
{
int i = (int)episodeId;
pagingSpec.FilterExpression = h => h.EpisodeId == i;
}
return ApplyToPage(_historyService.Paged, pagingSpec);
12 years ago
}
}
}