From 33de32b1383d209f6a22c451d5171c5920245c95 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Tue, 27 Aug 2024 06:51:45 +0300 Subject: [PATCH] Simplify app profile validation on indexers --- src/Prowlarr.Api.V1/Indexers/IndexerController.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Prowlarr.Api.V1/Indexers/IndexerController.cs b/src/Prowlarr.Api.V1/Indexers/IndexerController.cs index 972ae4426..0047acbca 100644 --- a/src/Prowlarr.Api.V1/Indexers/IndexerController.cs +++ b/src/Prowlarr.Api.V1/Indexers/IndexerController.cs @@ -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); } }