mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-23 22:25:14 -04:00
New: Use ASP.NET Core instead of Nancy
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
using FluentValidation;
|
||||
using NzbDrone.Core.ImportLists;
|
||||
using NzbDrone.Core.Validation;
|
||||
using NzbDrone.Core.Validation.Paths;
|
||||
using Radarr.Http;
|
||||
|
||||
namespace Radarr.Api.V3.ImportLists
|
||||
{
|
||||
[V3ApiController]
|
||||
public class ImportListController : ProviderControllerBase<ImportListResource, IImportList, ImportListDefinition>
|
||||
{
|
||||
public static readonly ImportListResourceMapper ResourceMapper = new ImportListResourceMapper();
|
||||
|
||||
public ImportListController(ImportListFactory importListFactory,
|
||||
ProfileExistsValidator profileExistsValidator)
|
||||
: base(importListFactory, "importlist", ResourceMapper)
|
||||
{
|
||||
SharedValidator.RuleFor(c => c.RootFolderPath).IsValidPath();
|
||||
SharedValidator.RuleFor(c => c.MinimumAvailability).NotNull();
|
||||
SharedValidator.RuleFor(c => c.QualityProfileId).ValidId();
|
||||
SharedValidator.RuleFor(c => c.QualityProfileId).SetValidator(profileExistsValidator);
|
||||
}
|
||||
|
||||
protected override void Validate(ImportListDefinition definition, bool includeWarnings)
|
||||
{
|
||||
if (!definition.Enable)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
base.Validate(definition, includeWarnings);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user