New: Add App Profile validation for indexers

Fixes #1903
This commit is contained in:
Bogdan
2023-10-25 13:04:02 +03:00
parent e0f6726a3d
commit 3963807c96
5 changed files with 37 additions and 37 deletions
@@ -1,4 +1,5 @@
using NzbDrone.Core.Indexers;
using NzbDrone.Core.Validation;
using Prowlarr.Http;
namespace Prowlarr.Api.V1.Indexers
@@ -6,9 +7,12 @@ namespace Prowlarr.Api.V1.Indexers
[V1ApiController]
public class IndexerController : ProviderControllerBase<IndexerResource, IndexerBulkResource, IIndexer, IndexerDefinition>
{
public IndexerController(IndexerFactory indexerFactory, IndexerResourceMapper resourceMapper, IndexerBulkResourceMapper bulkResourceMapper)
public IndexerController(IndexerFactory indexerFactory, IndexerResourceMapper resourceMapper, IndexerBulkResourceMapper bulkResourceMapper, AppProfileExistsValidator appProfileExistsValidator)
: base(indexerFactory, "indexer", resourceMapper, bulkResourceMapper)
{
Http.Validation.RuleBuilderExtensions.ValidId(SharedValidator.RuleFor(s => s.AppProfileId));
SharedValidator.RuleFor(c => c.AppProfileId).SetValidator(appProfileExistsValidator);
}
}
}