Simplify app profile validation on indexers

pull/2199/head
Bogdan 3 months ago
parent 753b53a529
commit 33de32b138

@ -1,3 +1,4 @@
using FluentValidation;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.Validation;
using Prowlarr.Http;
@ -14,9 +15,10 @@ namespace Prowlarr.Api.V1.Indexers
DownloadClientExistsValidator downloadClientExistsValidator)
: base(indexerFactory, "indexer", resourceMapper, bulkResourceMapper)
{
Http.Validation.RuleBuilderExtensions.ValidId(SharedValidator.RuleFor(s => s.AppProfileId));
SharedValidator.RuleFor(c => c.AppProfileId).Cascade(CascadeMode.Stop)
.ValidId()
.SetValidator(appProfileExistsValidator);
SharedValidator.RuleFor(c => c.AppProfileId).SetValidator(appProfileExistsValidator);
SharedValidator.RuleFor(c => c.DownloadClientId).SetValidator(downloadClientExistsValidator);
}
}

Loading…
Cancel
Save