mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-24 22:55:21 -04:00
Fixed: (Cardigann) Validate definition file and setting fields existence
Towards #2245
This commit is contained in:
@@ -1,11 +1,23 @@
|
||||
using System.Collections.Generic;
|
||||
using FluentValidation;
|
||||
using NzbDrone.Core.Annotations;
|
||||
using NzbDrone.Core.Indexers.Settings;
|
||||
using NzbDrone.Core.Validation;
|
||||
|
||||
namespace NzbDrone.Core.Indexers.Definitions.Cardigann
|
||||
{
|
||||
public class CardigannSettingsValidator : NoAuthSettingsValidator<CardigannSettings>
|
||||
{
|
||||
public CardigannSettingsValidator()
|
||||
{
|
||||
RuleFor(c => c.DefinitionFile).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class CardigannSettings : NoAuthTorrentBaseSettings
|
||||
{
|
||||
private static readonly CardigannSettingsValidator Validator = new ();
|
||||
|
||||
public CardigannSettings()
|
||||
{
|
||||
ExtraFieldData = new Dictionary<string, object>();
|
||||
@@ -15,5 +27,10 @@ namespace NzbDrone.Core.Indexers.Definitions.Cardigann
|
||||
public string DefinitionFile { get; set; }
|
||||
|
||||
public Dictionary<string, object> ExtraFieldData { get; set; }
|
||||
|
||||
public override NzbDroneValidationResult Validate()
|
||||
{
|
||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user