1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-20 21:55:03 -04:00
Files
Radarr/src/Radarr.Http/Validation/NetImportSyncIntervalValidator.cs
T
2020-09-03 22:50:56 -04:00

35 lines
758 B
C#

using FluentValidation.Validators;
namespace Radarr.Http.Validation
{
public class ImportListSyncIntervalValidator : PropertyValidator
{
public ImportListSyncIntervalValidator()
: base("Must be between 10 and 1440 or 0 to disable")
{
}
protected override bool IsValid(PropertyValidatorContext context)
{
if (context.PropertyValue == null)
{
return true;
}
var value = (int)context.PropertyValue;
if (value == 0)
{
return true;
}
if (value >= 10 && value <= 1440)
{
return true;
}
return false;
}
}
}