diff --git a/src/Prowlarr.Api.V1/History/HistoryController.cs b/src/Prowlarr.Api.V1/History/HistoryController.cs index 4b23abcc9..f9c31127d 100644 --- a/src/Prowlarr.Api.V1/History/HistoryController.cs +++ b/src/Prowlarr.Api.V1/History/HistoryController.cs @@ -19,13 +19,6 @@ namespace Prowlarr.Api.V1.History _historyService = historyService; } - protected HistoryResource MapToResource(NzbDrone.Core.History.History model) - { - var resource = model.ToResource(); - - return resource; - } - [HttpGet] [Produces("application/json")] public PagingResource GetHistory() @@ -55,14 +48,14 @@ namespace Prowlarr.Api.V1.History pagingSpec.FilterExpressions.Add(h => h.DownloadId == downloadId); } - return pagingSpec.ApplyToPage(_historyService.Paged, h => MapToResource(h)); + return pagingSpec.ApplyToPage(_historyService.Paged, MapToResource); } [HttpGet("since")] [Produces("application/json")] public List GetHistorySince(DateTime date, HistoryEventType? eventType = null) { - return _historyService.Since(date, eventType).Select(h => MapToResource(h)).ToList(); + return _historyService.Since(date, eventType).Select(MapToResource).ToList(); } [HttpGet("indexer")] @@ -71,10 +64,15 @@ namespace Prowlarr.Api.V1.History { if (limit.HasValue) { - return _historyService.GetByIndexerId(indexerId, eventType).Select(h => MapToResource(h)).Take(limit.Value).ToList(); + return _historyService.GetByIndexerId(indexerId, eventType).Select(MapToResource).Take(limit.Value).ToList(); } - return _historyService.GetByIndexerId(indexerId, eventType).Select(h => MapToResource(h)).ToList(); + return _historyService.GetByIndexerId(indexerId, eventType).Select(MapToResource).ToList(); + } + + protected HistoryResource MapToResource(NzbDrone.Core.History.History model) + { + return model.ToResource(); } } } diff --git a/src/Prowlarr.Api.V1/History/HistoryResource.cs b/src/Prowlarr.Api.V1/History/HistoryResource.cs index 3637798aa..6edc7b676 100644 --- a/src/Prowlarr.Api.V1/History/HistoryResource.cs +++ b/src/Prowlarr.Api.V1/History/HistoryResource.cs @@ -11,9 +11,7 @@ namespace Prowlarr.Api.V1.History public DateTime Date { get; set; } public string DownloadId { get; set; } public bool Successful { get; set; } - public HistoryEventType EventType { get; set; } - public Dictionary Data { get; set; } } @@ -29,16 +27,11 @@ namespace Prowlarr.Api.V1.History return new HistoryResource { Id = model.Id, - IndexerId = model.IndexerId, - - //QualityCutoffNotMet Date = model.Date, DownloadId = model.DownloadId, Successful = model.Successful, - EventType = model.EventType, - Data = model.Data }; }