39 lines
1.2 KiB
C#
39 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Linq;
|
|
using AutoMapper;
|
|
using Nancy;
|
|
using NzbDrone.Api.Episodes;
|
|
using NzbDrone.Api.Extensions;
|
|
using NzbDrone.Core.Datastore;
|
|
using NzbDrone.Core.History;
|
|
using NzbDrone.Core.Qualities;
|
|
using NzbDrone.Core.Tv;
|
|
|
|
namespace NzbDrone.Api.History
|
|
{
|
|
public class HistoryModule : NzbDroneRestModule<HistoryResource>
|
|
{
|
|
private readonly IHistoryService _historyService;
|
|
|
|
public HistoryModule(IHistoryService historyService)
|
|
{
|
|
_historyService = historyService;
|
|
GetResourcePaged = GetHistory;
|
|
}
|
|
|
|
private PagingResource<HistoryResource> GetHistory(PagingResource<HistoryResource> pagingResource)
|
|
{
|
|
var pagingSpec = new PagingSpec<Core.History.History>
|
|
{
|
|
Page = pagingResource.Page,
|
|
PageSize = pagingResource.PageSize,
|
|
SortKey = pagingResource.SortKey,
|
|
SortDirection = pagingResource.SortDirection
|
|
};
|
|
|
|
return ApplyToPage(_historyService.Paged, pagingSpec);
|
|
}
|
|
}
|
|
} |