|
|
@ -2,9 +2,11 @@
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
using FluentValidation;
|
|
|
|
using FluentValidation;
|
|
|
|
|
|
|
|
using Nancy;
|
|
|
|
using NzbDrone.Core.SeriesStats;
|
|
|
|
using NzbDrone.Core.SeriesStats;
|
|
|
|
using NzbDrone.Core.Tv;
|
|
|
|
using NzbDrone.Core.Tv;
|
|
|
|
using NzbDrone.Api.Validation;
|
|
|
|
using NzbDrone.Api.Validation;
|
|
|
|
|
|
|
|
using NzbDrone.Api.Extensions;
|
|
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Api.Series
|
|
|
|
namespace NzbDrone.Api.Series
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -25,15 +27,30 @@ namespace NzbDrone.Api.Series
|
|
|
|
UpdateResource = UpdateSeries;
|
|
|
|
UpdateResource = UpdateSeries;
|
|
|
|
DeleteResource = DeleteSeries;
|
|
|
|
DeleteResource = DeleteSeries;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Get["/{slug}"] = o => GetSeries((string)o.slug.ToString());
|
|
|
|
|
|
|
|
|
|
|
|
SharedValidator.RuleFor(s => s.RootFolderId).ValidId();
|
|
|
|
SharedValidator.RuleFor(s => s.RootFolderId).ValidId();
|
|
|
|
SharedValidator.RuleFor(s => s.QualityProfileId).ValidId();
|
|
|
|
SharedValidator.RuleFor(s => s.QualityProfileId).ValidId();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PostValidator.RuleFor(s => s.Title).NotEmpty();
|
|
|
|
PostValidator.RuleFor(s => s.Title).NotEmpty();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Response GetSeries(string slug)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var series = _seriesService.FindBySlug(slug);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (series == null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return new NotFoundResponse();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return series.AsResponse();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private List<SeriesResource> AllSeries()
|
|
|
|
private List<SeriesResource> AllSeries()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var seriesStats = _seriesStatisticsService.SeriesStatistics();
|
|
|
|
var seriesStats = _seriesStatisticsService.SeriesStatistics();
|
|
|
|