Esempio n. 1
0
        public ReleaseProfileModule(IReleaseProfileService releaseProfileService, IIndexerFactory indexerFactory)
        {
            _releaseProfileService = releaseProfileService;
            _indexerFactory        = indexerFactory;

            GetResourceById = GetReleaseProfile;
            GetResourceAll  = GetAll;
            CreateResource  = Create;
            UpdateResource  = Update;
            DeleteResource  = DeleteReleaseProfile;

            SharedValidator.RuleFor(d => d).Custom((restriction, context) =>
            {
                if (restriction.MapIgnored().Empty() && restriction.MapRequired().Empty() && restriction.Preferred.Empty())
                {
                    context.AddFailure("'Must contain', 'Must not contain' or 'Preferred' is required");
                }

                if (restriction.Enabled && restriction.IndexerId != 0 && !_indexerFactory.Exists(restriction.IndexerId))
                {
                    context.AddFailure(nameof(ReleaseProfile.IndexerId), "Indexer does not exist");
                }

                if (restriction.Preferred.Any(p => p.Key.IsNullOrWhiteSpace()))
                {
                    context.AddFailure("Preferred", "Term cannot be empty or consist of only spaces");
                }
            });
        }
Esempio n. 2
0
 public TagService(ITagRepository repo,
                   IEventAggregator eventAggregator,
                   IDelayProfileService delayProfileService,
                   INotificationFactory notificationFactory,
                   IReleaseProfileService releaseProfileService,
                   ISeriesService seriesService)
 {
     _repo                  = repo;
     _eventAggregator       = eventAggregator;
     _delayProfileService   = delayProfileService;
     _notificationFactory   = notificationFactory;
     _releaseProfileService = releaseProfileService;
     _seriesService         = seriesService;
 }
Esempio n. 3
0
 public TagService(ITagRepository repo,
                   IEventAggregator eventAggregator,
                   IDelayProfileService delayProfileService,
                   ImportListFactory importListFactory,
                   INotificationFactory notificationFactory,
                   IReleaseProfileService releaseProfileService,
                   IArtistService artistService)
 {
     _repo                  = repo;
     _eventAggregator       = eventAggregator;
     _delayProfileService   = delayProfileService;
     _importListFactory     = importListFactory;
     _notificationFactory   = notificationFactory;
     _releaseProfileService = releaseProfileService;
     _artistService         = artistService;
 }
Esempio n. 4
0
        public ReleaseProfileModule(IReleaseProfileService releaseProfileService)
        {
            _releaseProfileService = releaseProfileService;

            GetResourceById = GetReleaseProfile;
            GetResourceAll  = GetAll;
            CreateResource  = Create;
            UpdateResource  = Update;
            DeleteResource  = DeleteReleaseProfile;

            SharedValidator.RuleFor(d => d).Custom((restriction, context) =>
            {
                if (restriction.Ignored.IsNullOrWhiteSpace() && restriction.Required.IsNullOrWhiteSpace() && restriction.Preferred.Empty())
                {
                    context.AddFailure("'Must contain', 'Must not contain' or 'Preferred' is required");
                }
            });
        }
        public ReleaseProfileController(IReleaseProfileService releaseProfileService, IIndexerFactory indexerFactory)
        {
            _releaseProfileService = releaseProfileService;
            _indexerFactory        = indexerFactory;

            SharedValidator.RuleFor(r => r).Custom((restriction, context) =>
            {
                if (restriction.Ignored.IsNullOrWhiteSpace() && restriction.Required.IsNullOrWhiteSpace() && restriction.Preferred.Empty())
                {
                    context.AddFailure("Either 'Must contain' or 'Must not contain' is required");
                }

                if (restriction.Enabled && restriction.IndexerId != 0 && !_indexerFactory.Exists(restriction.IndexerId))
                {
                    context.AddFailure(nameof(ReleaseProfile.IndexerId), "Indexer does not exist");
                }
            });
        }
Esempio n. 6
0
        public RestrictionModule(IReleaseProfileService releaseProfileService)
        {
            _releaseProfileService = releaseProfileService;

            GetResourceById = GetRestriction;
            GetResourceAll  = GetAllRestrictions;
            CreateResource  = CreateRestriction;
            UpdateResource  = UpdateRestriction;
            DeleteResource  = DeleteRestriction;

            SharedValidator.RuleFor(r => r).Custom((restriction, context) =>
            {
                if (restriction.Ignored.IsNullOrWhiteSpace() && restriction.Required.IsNullOrWhiteSpace())
                {
                    context.AddFailure("Either 'Must contain' or 'Must not contain' is required");
                }
            });
        }
Esempio n. 7
0
        public ReleaseProfileModule(IReleaseProfileService releaseProfileService)
        {
            _releaseProfileService = releaseProfileService;

            GetResourceById = Get;
            GetResourceAll  = GetAll;
            CreateResource  = Create;
            UpdateResource  = Update;
            DeleteResource  = Delete;

            SharedValidator.Custom(restriction =>
            {
                if (restriction.Ignored.IsNullOrWhiteSpace() && restriction.Required.IsNullOrWhiteSpace() && restriction.Preferred.Empty())
                {
                    return(new ValidationFailure("", "'Must contain', 'Must not contain' or 'Preferred' is required"));
                }

                return(null);
            });
        }
Esempio n. 8
0
        public ReleaseProfileModule(IReleaseProfileService releaseProfileService, IIndexerFactory indexerFactory)
        {
            _releaseProfileService = releaseProfileService;
            _indexerFactory        = indexerFactory;

            GetResourceById = GetById;
            GetResourceAll  = GetAll;
            CreateResource  = Create;
            UpdateResource  = Update;
            DeleteResource  = DeleteById;

            SharedValidator.RuleFor(r => r).Custom((restriction, context) =>
            {
                if (restriction.Ignored.IsNullOrWhiteSpace() && restriction.Required.IsNullOrWhiteSpace() && restriction.Preferred.Empty())
                {
                    context.AddFailure("Either 'Must contain' or 'Must not contain' is required");
                }

                if (restriction.Enabled && restriction.IndexerId != 0 && !_indexerFactory.Exists(restriction.IndexerId))
                {
                    context.AddFailure(nameof(ReleaseProfile.IndexerId), "Indexer does not exist");
                }
            });
        }
 public ReleaseRestrictionsSpecification(ITermMatcherService termMatcherService, IReleaseProfileService releaseProfileService, Logger logger)
 {
     _logger = logger;
     _releaseProfileService = releaseProfileService;
     _termMatcherService    = termMatcherService;
 }
Esempio n. 10
0
 public PreferredWordService(IReleaseProfileService releaseProfileService, ITermMatcherService termMatcherService, Logger logger)
 {
     _releaseProfileService = releaseProfileService;
     _termMatcherService    = termMatcherService;
     _logger = logger;
 }