1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00
Sonarr/NzbDrone.Api/History/HistoryModule.cs

39 lines
1.2 KiB
C#
Raw Normal View History

2013-05-03 09:53:32 +03:00
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
{
2013-05-13 09:12:19 +03:00
public class HistoryModule : NzbDroneRestModule<HistoryResource>
2013-05-03 09:53:32 +03:00
{
private readonly IHistoryService _historyService;
public HistoryModule(IHistoryService historyService)
{
_historyService = historyService;
2013-05-13 09:12:19 +03:00
GetResourcePaged = GetHistory;
2013-05-03 09:53:32 +03:00
}
2013-05-13 09:12:19 +03:00
private PagingResource<HistoryResource> GetHistory(PagingResource<HistoryResource> pagingResource)
2013-05-03 09:53:32 +03:00
{
2013-05-11 01:33:04 +03:00
var pagingSpec = new PagingSpec<Core.History.History>
2013-05-03 09:53:32 +03:00
{
2013-05-13 09:12:19 +03:00
Page = pagingResource.Page,
PageSize = pagingResource.PageSize,
SortKey = pagingResource.SortKey,
SortDirection = pagingResource.SortDirection
2013-05-03 09:53:32 +03:00
};
2013-05-13 09:12:19 +03:00
return ApplyToPage(_historyService.Paged, pagingSpec);
2013-05-03 09:53:32 +03:00
}
}
}