mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Fixed: Significantly improved api performance.
This commit is contained in:
@@ -6,6 +6,7 @@ using NzbDrone.Api.Series;
|
||||
using NzbDrone.Api.Episodes;
|
||||
using NzbDrone.Core.Download.TrackedDownloads;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using System.Linq;
|
||||
|
||||
namespace NzbDrone.Api.Queue
|
||||
{
|
||||
@@ -25,4 +26,36 @@ namespace NzbDrone.Api.Queue
|
||||
public string DownloadId { get; set; }
|
||||
public DownloadProtocol Protocol { get; set; }
|
||||
}
|
||||
|
||||
public static class QueueResourceMapper
|
||||
{
|
||||
public static QueueResource ToResource(this Core.Queue.Queue model)
|
||||
{
|
||||
if (model == null) return null;
|
||||
|
||||
return new QueueResource
|
||||
{
|
||||
Id = model.Id,
|
||||
|
||||
Series = model.Series.ToResource(),
|
||||
Episode = model.Episode.ToResource(),
|
||||
Quality = model.Quality,
|
||||
Size = model.Size,
|
||||
Title = model.Title,
|
||||
Sizeleft = model.Sizeleft,
|
||||
Timeleft = model.Timeleft,
|
||||
EstimatedCompletionTime = model.EstimatedCompletionTime,
|
||||
Status = model.Status,
|
||||
TrackedDownloadStatus = model.TrackedDownloadStatus,
|
||||
StatusMessages = model.StatusMessages,
|
||||
DownloadId = model.DownloadId,
|
||||
Protocol = model.Protocol
|
||||
};
|
||||
}
|
||||
|
||||
public static List<QueueResource> ToResource(this IEnumerable<Core.Queue.Queue> models)
|
||||
{
|
||||
return models.Select(ToResource).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user