You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
910 B
33 lines
910 B
using FluentValidation;
|
|
|
|
namespace Recyclarr.TrashGuide.ReleaseProfile;
|
|
|
|
public class TermDataValidator : AbstractValidator<TermData>
|
|
{
|
|
public TermDataValidator()
|
|
{
|
|
RuleFor(x => x.Term).NotEmpty();
|
|
}
|
|
}
|
|
|
|
public class PreferredTermDataValidator : AbstractValidator<PreferredTermData>
|
|
{
|
|
public PreferredTermDataValidator()
|
|
{
|
|
RuleFor(x => x.Terms).NotEmpty();
|
|
RuleForEach(x => x.Terms).SetValidator(new TermDataValidator());
|
|
}
|
|
}
|
|
|
|
public class ReleaseProfileDataValidator : AbstractValidator<ReleaseProfileData>
|
|
{
|
|
public ReleaseProfileDataValidator()
|
|
{
|
|
RuleFor(x => x.Name).NotEmpty();
|
|
RuleFor(x => x.TrashId).NotEmpty();
|
|
RuleFor(x => x)
|
|
.Must(x => x.Required.Count != 0 || x.Ignored.Count != 0 || x.Preferred.Count != 0)
|
|
.WithMessage("Must have at least one of Required, Ignored, or Preferred terms");
|
|
}
|
|
}
|