You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.2 KiB
33 lines
1.2 KiB
using System.Collections.Generic;
|
|
using NzbDrone.Core.ImportLists;
|
|
|
|
namespace Radarr.Api.V3.ImportLists
|
|
{
|
|
public class ImportListBulkResource : ProviderBulkResource<ImportListBulkResource>
|
|
{
|
|
public bool? EnableAuto { get; set; }
|
|
public string RootFolderPath { get; set; }
|
|
public List<int> QualityProfileIds { get; set; }
|
|
}
|
|
|
|
public class ImportListBulkResourceMapper : ProviderBulkResourceMapper<ImportListBulkResource, ImportListDefinition>
|
|
{
|
|
public override List<ImportListDefinition> UpdateModel(ImportListBulkResource resource, List<ImportListDefinition> existingDefinitions)
|
|
{
|
|
if (resource == null)
|
|
{
|
|
return new List<ImportListDefinition>();
|
|
}
|
|
|
|
existingDefinitions.ForEach(existing =>
|
|
{
|
|
existing.EnableAuto = resource.EnableAuto ?? existing.EnableAuto;
|
|
existing.RootFolderPath = resource.RootFolderPath ?? existing.RootFolderPath;
|
|
existing.QualityProfileIds = resource.QualityProfileIds ?? existing.QualityProfileIds;
|
|
});
|
|
|
|
return existingDefinitions;
|
|
}
|
|
}
|
|
}
|