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.
Sonarr/NzbDrone.Api/Logs/LogModule.cs

29 lines
766 B

using NzbDrone.Core.Datastore;
using NzbDrone.Core.Instrumentation;
using NzbDrone.Api.Mapping;
namespace NzbDrone.Api.Logs
{
public class LogModule : NzbDroneRestModule<LogResource>
{
private readonly ILogService _logService;
public LogModule(ILogService logService)
{
_logService = logService;
GetResourcePaged = GetLogs;
}
private PagingResource<LogResource> GetLogs(PagingResource<LogResource> pagingResource)
{
var pageSpec = pagingResource.InjectTo<PagingSpec<Log>>();
if (pageSpec.SortKey == "time")
{
pageSpec.SortKey = "id";
}
return ApplyToPage(_logService.Paged, pageSpec);
}
}
}