mirror of
https://github.com/fergalmoran/Readarr.git
synced 2025-12-31 05:48:18 +00:00
Fixed: Groups must contain multiple qualities
This commit is contained in:
@@ -13,7 +13,7 @@ namespace Lidarr.Api.V1.Profiles.Quality
|
|||||||
ruleBuilder.SetValidator(new NotEmptyValidator(null));
|
ruleBuilder.SetValidator(new NotEmptyValidator(null));
|
||||||
ruleBuilder.SetValidator(new AllowedValidator<T>());
|
ruleBuilder.SetValidator(new AllowedValidator<T>());
|
||||||
ruleBuilder.SetValidator(new QualityNameValidator<T>());
|
ruleBuilder.SetValidator(new QualityNameValidator<T>());
|
||||||
ruleBuilder.SetValidator(new EmptyItemGroupNameValidator<T>());
|
ruleBuilder.SetValidator(new GroupItemValidator<T>());
|
||||||
ruleBuilder.SetValidator(new ItemGroupIdValidator<T>());
|
ruleBuilder.SetValidator(new ItemGroupIdValidator<T>());
|
||||||
ruleBuilder.SetValidator(new UniqueIdValidator<T>());
|
ruleBuilder.SetValidator(new UniqueIdValidator<T>());
|
||||||
ruleBuilder.SetValidator(new UniqueQualityIdValidator<T>());
|
ruleBuilder.SetValidator(new UniqueQualityIdValidator<T>());
|
||||||
@@ -47,10 +47,10 @@ namespace Lidarr.Api.V1.Profiles.Quality
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EmptyItemGroupNameValidator<T> : PropertyValidator
|
public class GroupItemValidator<T> : PropertyValidator
|
||||||
{
|
{
|
||||||
public EmptyItemGroupNameValidator()
|
public GroupItemValidator()
|
||||||
: base("Groups must not be empty")
|
: base("Groups must contain multiple qualities")
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -59,7 +59,7 @@ namespace Lidarr.Api.V1.Profiles.Quality
|
|||||||
{
|
{
|
||||||
var items = context.PropertyValue as IList<QualityProfileQualityItemResource>;
|
var items = context.PropertyValue as IList<QualityProfileQualityItemResource>;
|
||||||
|
|
||||||
if (items.Any(i => i.Name.IsNotNullOrWhiteSpace() && i.Items.Empty()))
|
if (items.Any(i => i.Name.IsNotNullOrWhiteSpace() && i.Items.Count <= 1))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ namespace Lidarr.Api.V1.Profiles.Quality
|
|||||||
{
|
{
|
||||||
_profileService = profileService;
|
_profileService = profileService;
|
||||||
SharedValidator.RuleFor(c => c.Name).NotEmpty();
|
SharedValidator.RuleFor(c => c.Name).NotEmpty();
|
||||||
// TODO: Need to validate the cutoff is allowed and the ID/quality ID exists
|
|
||||||
// TODO: Need to validate the Items to ensure groups have names and at no item has no name, no items and no quality
|
|
||||||
SharedValidator.RuleFor(c => c.Cutoff).ValidCutoff();
|
SharedValidator.RuleFor(c => c.Cutoff).ValidCutoff();
|
||||||
SharedValidator.RuleFor(c => c.Items).ValidItems();
|
SharedValidator.RuleFor(c => c.Items).ValidItems();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user