1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-10-03 22:57:18 +02:00

Fixed: Filter history by multiple event types

This commit is contained in:
Bogdan 2024-01-04 11:21:53 +02:00
parent 4630de9616
commit bda2b9b0b8

View File

@ -61,15 +61,15 @@ protected HistoryResource MapToResource(MovieHistory model, bool includeMovie)
[HttpGet]
[Produces("application/json")]
public PagingResource<HistoryResource> GetHistory([FromQuery] PagingRequestResource paging, bool includeMovie, int? eventType, string downloadId, [FromQuery] int[] movieIds = null, [FromQuery] int[] languages = null, [FromQuery] int[] quality = null)
public PagingResource<HistoryResource> GetHistory([FromQuery] PagingRequestResource paging, bool includeMovie, [FromQuery(Name = "eventType")] int[] eventTypes, string downloadId, [FromQuery] int[] movieIds = null, [FromQuery] int[] languages = null, [FromQuery] int[] quality = null)
{
var pagingResource = new PagingResource<HistoryResource>(paging);
var pagingSpec = pagingResource.MapToPagingSpec<HistoryResource, MovieHistory>("date", SortDirection.Descending);
if (eventType.HasValue)
if (eventTypes != null && eventTypes.Any())
{
var filterValue = (MovieHistoryEventType)eventType.Value;
pagingSpec.FilterExpressions.Add(v => v.EventType == filterValue);
var filterValues = eventTypes.Cast<MovieHistoryEventType>().ToArray();
pagingSpec.FilterExpressions.Add(v => filterValues.Contains(v.EventType));
}
if (downloadId.IsNotNullOrWhiteSpace())