1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-19 21:46:50 -04:00

New: Allowed sort keys for paginated resources

This commit is contained in:
Bogdan
2024-09-16 19:49:23 +03:00
parent 3ca327f611
commit fabd40cbae
8 changed files with 73 additions and 20 deletions
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
@@ -29,7 +30,18 @@ namespace Radarr.Api.V3.Blocklist
public PagingResource<BlocklistResource> GetBlocklist([FromQuery] PagingRequestResource paging, [FromQuery] int[] movieIds = null, [FromQuery] DownloadProtocol[] protocols = null)
{
var pagingResource = new PagingResource<BlocklistResource>(paging);
var pagingSpec = pagingResource.MapToPagingSpec<BlocklistResource, NzbDrone.Core.Blocklisting.Blocklist>("date", SortDirection.Descending);
var pagingSpec = pagingResource.MapToPagingSpec<BlocklistResource, NzbDrone.Core.Blocklisting.Blocklist>(
"date",
SortDirection.Descending,
new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{
"movieMetadata.sortTitle",
"sourceTitle",
"languages",
"quality",
"date",
"indexer"
});
if (movieIds?.Any() == true)
{