From 74c89e1d4412f2dde8fed83fb5aa04cb1fcfef2c Mon Sep 17 00:00:00 2001 From: Qstick Date: Wed, 6 Jan 2021 23:19:31 -0500 Subject: [PATCH] Enforce Selection of Credit Type on Person Lists Fixes: #5684 --- .../TMDb/Person/TMDbPersonSettings.cs | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core/ImportLists/TMDb/Person/TMDbPersonSettings.cs b/src/NzbDrone.Core/ImportLists/TMDb/Person/TMDbPersonSettings.cs index ade0a1421..de2df5933 100644 --- a/src/NzbDrone.Core/ImportLists/TMDb/Person/TMDbPersonSettings.cs +++ b/src/NzbDrone.Core/ImportLists/TMDb/Person/TMDbPersonSettings.cs @@ -1,4 +1,4 @@ -using System.Text.RegularExpressions; +using System.Text.RegularExpressions; using FluentValidation; using NzbDrone.Core.Annotations; @@ -10,6 +10,27 @@ namespace NzbDrone.Core.ImportLists.TMDb.Person : base() { RuleFor(c => c.PersonId).Matches(@"^[1-9][0-9]*$", RegexOptions.IgnoreCase); + + RuleFor(c => c.PersonCast) + .Equal(true) + .Unless(c => c.PersonCastDirector || c.PersonCastProducer || c.PersonCastSound || c.PersonCastWriting) + .WithMessage("Must Select One Credit Type Option"); + RuleFor(c => c.PersonCastDirector) + .Equal(true) + .Unless(c => c.PersonCast || c.PersonCastProducer || c.PersonCastSound || c.PersonCastWriting) + .WithMessage("Must Select One Credit Type Option"); + RuleFor(c => c.PersonCastProducer) + .Equal(true) + .Unless(c => c.PersonCastDirector || c.PersonCast || c.PersonCastSound || c.PersonCastWriting) + .WithMessage("Must Select One Credit Type Option"); + RuleFor(c => c.PersonCastSound) + .Equal(true) + .Unless(c => c.PersonCastDirector || c.PersonCastProducer || c.PersonCast || c.PersonCastWriting) + .WithMessage("Must Select One Credit Type Option"); + RuleFor(c => c.PersonCastWriting) + .Equal(true) + .Unless(c => c.PersonCastDirector || c.PersonCastProducer || c.PersonCastSound || c.PersonCast) + .WithMessage("Must Select One Credit Type Option"); } }