Radarr/src/NzbDrone.Core/ImportLists/TMDb/List/TMDbListSettings.cs

33 lines
931 B
C#
Raw Normal View History

using FluentValidation;
2019-12-15 07:34:27 +00:00
using NzbDrone.Core.Annotations;
using NzbDrone.Core.Validation;
2019-12-15 07:34:27 +00:00
namespace NzbDrone.Core.ImportLists.TMDb.List
2019-12-15 07:34:27 +00:00
{
public class TMDbListSettingsValidator : TMDbSettingsBaseValidator<TMDbListSettings>
{
public TMDbListSettingsValidator()
{
RuleFor(c => c.ListId).Matches("^[1-9][0-9]*$").NotEmpty();
2019-12-15 07:34:27 +00:00
}
}
public class TMDbListSettings : TMDbSettingsBase<TMDbListSettings>
{
private static readonly TMDbListSettingsValidator Validator = new ();
2019-12-15 07:34:27 +00:00
public TMDbListSettings()
{
ListId = "";
}
[FieldDefinition(1, Label = "ListId", Type = FieldType.Textbox, HelpText = "TMDb Id of List to Follow")]
public string ListId { get; set; }
public override NzbDroneValidationResult Validate()
{
return new NzbDroneValidationResult(Validator.Validate(this));
}
2019-12-15 07:34:27 +00:00
}
}