1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-10-29 23:12:39 +01:00

Fixed: Sorting queue by columns

Sort allowed keys

Co-authored-by: Mark McDowall <markus.mcd5@gmail.com>
This commit is contained in:
Bogdan 2024-09-22 07:21:53 +03:00 committed by Mark McDowall
parent be4a9e9491
commit 30a52d11aa
6 changed files with 36 additions and 12 deletions

View File

@ -33,10 +33,10 @@ namespace Sonarr.Api.V3.Blocklist
var pagingSpec = pagingResource.MapToPagingSpec<BlocklistResource, NzbDrone.Core.Blocklisting.Blocklist>(
new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{
"series.sortTitle",
"sourceTitle",
"date",
"indexer"
"indexer",
"series.sortTitle",
"sourceTitle"
},
"date",
SortDirection.Descending);

View File

@ -68,8 +68,8 @@ namespace Sonarr.Api.V3.History
var pagingSpec = pagingResource.MapToPagingSpec<HistoryResource, EpisodeHistory>(
new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{
"series.sortTitle",
"date"
"date",
"series.sortTitle"
},
"date",
SortDirection.Descending);

View File

@ -51,8 +51,8 @@ namespace Sonarr.Api.V3.ImportLists
new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{
"id",
"tvdbId",
"title"
"title",
"tvdbId"
},
"id",
SortDirection.Descending);

View File

@ -139,7 +139,31 @@ namespace Sonarr.Api.V3.Queue
public PagingResource<QueueResource> GetQueue([FromQuery] PagingRequestResource paging, bool includeUnknownSeriesItems = false, bool includeSeries = false, bool includeEpisode = false, [FromQuery] int[] seriesIds = null, DownloadProtocol? protocol = null, [FromQuery] int[] languages = null, int? quality = null)
{
var pagingResource = new PagingResource<QueueResource>(paging);
var pagingSpec = pagingResource.MapToPagingSpec<QueueResource, NzbDrone.Core.Queue.Queue>(null, "timeleft", SortDirection.Ascending);
var pagingSpec = pagingResource.MapToPagingSpec<QueueResource, NzbDrone.Core.Queue.Queue>(
new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{
"added",
"downloadClient",
"episode",
"episode.airDateUtc",
"episode.title",
"episodes.airDateUtc",
"episodes.title",
"estimatedCompletionTime",
"indexer",
"language",
"languages",
"progress",
"protocol",
"quality",
"series.sortTitle",
"size",
"status",
"timeleft",
"title"
},
"timeleft",
SortDirection.Ascending);
return pagingSpec.ApplyToPage((spec) => GetQueue(spec, seriesIds?.ToHashSet(), protocol, languages?.ToHashSet(), quality, includeUnknownSeriesItems), (q) => MapToResource(q, includeSeries, includeEpisode));
}

View File

@ -36,9 +36,9 @@ namespace Sonarr.Api.V3.Wanted
var pagingSpec = pagingResource.MapToPagingSpec<EpisodeResource, Episode>(
new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{
"series.sortTitle",
"episodes.airDateUtc",
"episodes.lastSearchTime"
"episodes.lastSearchTime",
"series.sortTitle"
},
"episodes.airDateUtc",
SortDirection.Ascending);

View File

@ -32,9 +32,9 @@ namespace Sonarr.Api.V3.Wanted
var pagingSpec = pagingResource.MapToPagingSpec<EpisodeResource, Episode>(
new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{
"series.sortTitle",
"episodes.airDateUtc",
"episodes.lastSearchTime"
"episodes.lastSearchTime",
"series.sortTitle"
},
"episodes.airDateUtc",
SortDirection.Ascending);