mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 02:37:08 -07:00
added input validation to quality profiles
This commit is contained in:
parent
6367d3d204
commit
147bb5476b
3 changed files with 85 additions and 79 deletions
|
@ -1,20 +1,11 @@
|
|||
using System.Collections.Generic;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Api.Mapping;
|
||||
using System.Linq;
|
||||
using FluentValidation;
|
||||
|
||||
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>
|
||||
{
|
||||
private readonly QualityProfileService _qualityProfileService;
|
||||
|
@ -24,6 +15,10 @@ namespace NzbDrone.Api.Qualities
|
|||
{
|
||||
_qualityProfileService = qualityProfileService;
|
||||
|
||||
SharedValidator.RuleFor(c => c.Name).NotEmpty();
|
||||
SharedValidator.RuleFor(c => c.Cutoff).NotNull();
|
||||
SharedValidator.RuleFor(c => c.Allowed).NotEmpty();
|
||||
|
||||
GetResourceAll = GetAll;
|
||||
|
||||
GetResourceById = GetById;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue