|
|
@ -1,20 +1,11 @@
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using NzbDrone.Core.Datastore;
|
|
|
|
|
|
|
|
using NzbDrone.Core.Qualities;
|
|
|
|
using NzbDrone.Core.Qualities;
|
|
|
|
using NzbDrone.Api.Mapping;
|
|
|
|
using NzbDrone.Api.Mapping;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
using FluentValidation;
|
|
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Api.Qualities
|
|
|
|
namespace NzbDrone.Api.Qualities
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
public static class LazyLoadedExtensions
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
public static IEnumerable<int> GetForeignKeys(this IEnumerable<ModelBase> models)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return models.Select(c => c.Id).Distinct();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class QualityProfileModule : NzbDroneRestModule<QualityProfileResource>
|
|
|
|
public class QualityProfileModule : NzbDroneRestModule<QualityProfileResource>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private readonly QualityProfileService _qualityProfileService;
|
|
|
|
private readonly QualityProfileService _qualityProfileService;
|
|
|
@ -24,6 +15,10 @@ namespace NzbDrone.Api.Qualities
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_qualityProfileService = qualityProfileService;
|
|
|
|
_qualityProfileService = qualityProfileService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SharedValidator.RuleFor(c => c.Name).NotEmpty();
|
|
|
|
|
|
|
|
SharedValidator.RuleFor(c => c.Cutoff).NotNull();
|
|
|
|
|
|
|
|
SharedValidator.RuleFor(c => c.Allowed).NotEmpty();
|
|
|
|
|
|
|
|
|
|
|
|
GetResourceAll = GetAll;
|
|
|
|
GetResourceAll = GetAll;
|
|
|
|
|
|
|
|
|
|
|
|
GetResourceById = GetById;
|
|
|
|
GetResourceById = GetById;
|
|
|
|