Enforce Selection of Credit Type on Person Lists

Fixes: #5684
pull/5710/head
Qstick 4 years ago
parent f120b84c43
commit 74c89e1d44

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

Loading…
Cancel
Save