mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-20 18:02:44 +01:00
Fixed: Filter history by multiple event types
This commit is contained in:
parent
4630de9616
commit
bda2b9b0b8
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user