Enforce Selection of Credit Type on Person Lists

Fixes: #5684
This commit is contained in:
Qstick 2021-01-06 23:19:31 -05:00
parent f120b84c43
commit 74c89e1d44
1 changed files with 22 additions and 1 deletions

View File

@ -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");
}
}