2013-05-30 17:12:20 -07:00
|
|
|
using NzbDrone.Core.Datastore;
|
2013-05-02 23:53:32 -07:00
|
|
|
using NzbDrone.Core.History;
|
|
|
|
|
|
|
|
namespace NzbDrone.Api.History
|
|
|
|
{
|
2013-05-12 23:12:19 -07:00
|
|
|
public class HistoryModule : NzbDroneRestModule<HistoryResource>
|
2013-05-02 23:53:32 -07:00
|
|
|
{
|
|
|
|
private readonly IHistoryService _historyService;
|
|
|
|
|
|
|
|
public HistoryModule(IHistoryService historyService)
|
|
|
|
{
|
|
|
|
_historyService = historyService;
|
2013-05-12 23:12:19 -07:00
|
|
|
GetResourcePaged = GetHistory;
|
2013-05-02 23:53:32 -07:00
|
|
|
}
|
|
|
|
|
2013-05-12 23:12:19 -07:00
|
|
|
private PagingResource<HistoryResource> GetHistory(PagingResource<HistoryResource> pagingResource)
|
2013-05-02 23:53:32 -07:00
|
|
|
{
|
2013-05-10 15:33:04 -07:00
|
|
|
var pagingSpec = new PagingSpec<Core.History.History>
|
2013-05-02 23:53:32 -07:00
|
|
|
{
|
2013-05-12 23:12:19 -07:00
|
|
|
Page = pagingResource.Page,
|
|
|
|
PageSize = pagingResource.PageSize,
|
|
|
|
SortKey = pagingResource.SortKey,
|
|
|
|
SortDirection = pagingResource.SortDirection
|
2013-05-02 23:53:32 -07:00
|
|
|
};
|
|
|
|
|
2013-05-12 23:12:19 -07:00
|
|
|
return ApplyToPage(_historyService.Paged, pagingSpec);
|
2013-05-02 23:53:32 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|