mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-10-02 16:52:04 +02:00
Fixed: Filter history by multiple event types
This commit is contained in:
@@ -22,15 +22,15 @@ namespace Prowlarr.Api.V1.History
|
|||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
public PagingResource<HistoryResource> GetHistory([FromQuery] PagingRequestResource paging, int? eventType, bool? successful, string downloadId)
|
public PagingResource<HistoryResource> GetHistory([FromQuery] PagingRequestResource paging, [FromQuery(Name = "eventType")] int[] eventTypes, bool? successful, string downloadId)
|
||||||
{
|
{
|
||||||
var pagingResource = new PagingResource<HistoryResource>(paging);
|
var pagingResource = new PagingResource<HistoryResource>(paging);
|
||||||
var pagingSpec = pagingResource.MapToPagingSpec<HistoryResource, NzbDrone.Core.History.History>("date", SortDirection.Descending);
|
var pagingSpec = pagingResource.MapToPagingSpec<HistoryResource, NzbDrone.Core.History.History>("date", SortDirection.Descending);
|
||||||
|
|
||||||
if (eventType.HasValue)
|
if (eventTypes != null && eventTypes.Any())
|
||||||
{
|
{
|
||||||
var filterValue = (HistoryEventType)eventType.Value;
|
var filterValues = eventTypes.Cast<HistoryEventType>().ToArray();
|
||||||
pagingSpec.FilterExpressions.Add(v => v.EventType == filterValue);
|
pagingSpec.FilterExpressions.Add(v => filterValues.Contains(v.EventType));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (successful.HasValue)
|
if (successful.HasValue)
|
||||||
|
Reference in New Issue
Block a user