2018-03-26 07:03:43 +00:00
|
|
|
using FluentValidation;
|
2015-12-20 02:02:38 +00:00
|
|
|
using NzbDrone.Api.Validation;
|
2014-02-16 09:56:12 +00:00
|
|
|
using NzbDrone.Core.Configuration;
|
|
|
|
|
|
|
|
namespace NzbDrone.Api.Config
|
|
|
|
{
|
|
|
|
public class IndexerConfigModule : NzbDroneConfigModule<IndexerConfigResource>
|
|
|
|
{
|
|
|
|
|
|
|
|
public IndexerConfigModule(IConfigService configService)
|
|
|
|
: base(configService)
|
|
|
|
{
|
2014-12-15 23:40:53 +00:00
|
|
|
SharedValidator.RuleFor(c => c.MinimumAge)
|
2014-12-16 00:31:26 +00:00
|
|
|
.GreaterThanOrEqualTo(0);
|
2014-12-15 23:40:53 +00:00
|
|
|
|
2018-03-26 07:03:43 +00:00
|
|
|
SharedValidator.RuleFor(c => c.MaximumSize)
|
|
|
|
.GreaterThanOrEqualTo(0);
|
|
|
|
|
2014-12-15 23:40:53 +00:00
|
|
|
SharedValidator.RuleFor(c => c.Retention)
|
|
|
|
.GreaterThanOrEqualTo(0);
|
|
|
|
|
2014-04-11 01:14:03 +00:00
|
|
|
SharedValidator.RuleFor(c => c.RssSyncInterval)
|
2015-12-20 02:02:38 +00:00
|
|
|
.IsValidRssSyncInterval();
|
2014-02-16 09:56:12 +00:00
|
|
|
}
|
2016-03-25 00:56:29 +00:00
|
|
|
|
|
|
|
protected override IndexerConfigResource ToResource(IConfigService model)
|
|
|
|
{
|
|
|
|
return IndexerConfigResourceMapper.ToResource(model);
|
|
|
|
}
|
2014-02-16 09:56:12 +00:00
|
|
|
}
|
2018-03-26 07:03:43 +00:00
|
|
|
}
|