2018-11-23 07:03:32 +00:00
|
|
|
using FluentValidation.Validators;
|
2017-01-28 19:59:21 +00:00
|
|
|
|
2018-11-23 07:03:32 +00:00
|
|
|
namespace Radarr.Http.Validation
|
2017-01-28 19:59:21 +00:00
|
|
|
{
|
2020-09-04 02:50:56 +00:00
|
|
|
public class ImportListSyncIntervalValidator : PropertyValidator
|
2017-01-28 19:59:21 +00:00
|
|
|
{
|
2020-09-04 02:50:56 +00:00
|
|
|
public ImportListSyncIntervalValidator()
|
2020-11-28 21:34:07 +00:00
|
|
|
: base("Must be greater than 6 hours")
|
2017-01-28 19:59:21 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override bool IsValid(PropertyValidatorContext context)
|
|
|
|
{
|
|
|
|
if (context.PropertyValue == null)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
var value = (int)context.PropertyValue;
|
|
|
|
|
2020-11-28 21:34:07 +00:00
|
|
|
if (value >= 6)
|
2017-01-28 19:59:21 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|