mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-12-28 16:56:00 +01:00
35 lines
756 B
C#
35 lines
756 B
C#
using FluentValidation.Validators;
|
|
|
|
namespace Radarr.Http.Validation
|
|
{
|
|
public class NetImportSyncIntervalValidator : PropertyValidator
|
|
{
|
|
public NetImportSyncIntervalValidator()
|
|
: 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;
|
|
}
|
|
}
|
|
}
|