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
908 B
33 lines
908 B
using FluentValidation;
|
|
|
|
namespace Recyclarr.TrashLib.Services.ReleaseProfile;
|
|
|
|
internal class TermDataValidator : AbstractValidator<TermData>
|
|
{
|
|
public TermDataValidator()
|
|
{
|
|
RuleFor(x => x.Term).NotEmpty();
|
|
}
|
|
}
|
|
|
|
internal class PreferredTermDataValidator : AbstractValidator<PreferredTermData>
|
|
{
|
|
public PreferredTermDataValidator()
|
|
{
|
|
RuleFor(x => x.Terms).NotEmpty();
|
|
RuleForEach(x => x.Terms).SetValidator(new TermDataValidator());
|
|
}
|
|
}
|
|
|
|
internal class ReleaseProfileDataValidator : AbstractValidator<ReleaseProfileData>
|
|
{
|
|
public ReleaseProfileDataValidator()
|
|
{
|
|
RuleFor(x => x.Name).NotEmpty();
|
|
RuleFor(x => x.TrashId).NotEmpty();
|
|
RuleFor(x => x)
|
|
.Must(x => x.Required.Any() || x.Ignored.Any() || x.Preferred.Any())
|
|
.WithMessage("Must have at least one of Required, Ignored, or Preferred terms");
|
|
}
|
|
}
|