|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
using FluentValidation;
|
|
|
|
|
using NzbDrone.Core.NetImport;
|
|
|
|
|
using NzbDrone.Core.Validation;
|
|
|
|
|
using NzbDrone.Core.Validation.Paths;
|
|
|
|
|
|
|
|
|
|
namespace Radarr.Api.V3.NetImport
|
|
|
|
@ -8,12 +9,13 @@ namespace Radarr.Api.V3.NetImport
|
|
|
|
|
{
|
|
|
|
|
public static readonly NetImportResourceMapper ResourceMapper = new NetImportResourceMapper();
|
|
|
|
|
|
|
|
|
|
public NetImportModule(NetImportFactory netImportFactory)
|
|
|
|
|
public NetImportModule(NetImportFactory netImportFactory, ProfileExistsValidator profileExistsValidator)
|
|
|
|
|
: base(netImportFactory, "netimport", ResourceMapper)
|
|
|
|
|
{
|
|
|
|
|
SharedValidator.RuleFor(c => c.RootFolderPath).IsValidPath();
|
|
|
|
|
SharedValidator.RuleFor(c => c.MinimumAvailability).NotNull();
|
|
|
|
|
SharedValidator.RuleFor(c => c.QualityProfileId).NotNull();
|
|
|
|
|
SharedValidator.RuleFor(c => c.QualityProfileId).ValidId();
|
|
|
|
|
SharedValidator.RuleFor(c => c.QualityProfileId).SetValidator(profileExistsValidator);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Validate(NetImportDefinition definition, bool includeWarnings)
|
|
|
|
|