Radarr/src/Radarr.Api.V3/Config/IndexerConfigModule.cs

32 lines
948 B
C#

using FluentValidation;
using Radarr.Http.Validation;
using NzbDrone.Core.Configuration;
namespace Radarr.Api.V3.Config
{
public class IndexerConfigModule : RadarrConfigModule<IndexerConfigResource>
{
public IndexerConfigModule(IConfigService configService)
: base(configService)
{
SharedValidator.RuleFor(c => c.MinimumAge)
.GreaterThanOrEqualTo(0);
SharedValidator.RuleFor(c => c.MaximumSize)
.GreaterThanOrEqualTo(0);
SharedValidator.RuleFor(c => c.Retention)
.GreaterThanOrEqualTo(0);
SharedValidator.RuleFor(c => c.RssSyncInterval)
.IsValidRssSyncInterval();
}
protected override IndexerConfigResource ToResource(IConfigService model)
{
return IndexerConfigResourceMapper.ToResource(model);
}
}
}