mirror of
https://github.com/Sonarr/Sonarr.git
synced 2025-03-25 22:00:54 +02:00
feat: Shift quality definition limits management to the backend
This update moves the minimum, maximum, and preferred quality limits to the backend, accessible via the new `/qualitydefinition/limits` endpoint. This change improves support for unofficial Sonarr API clients and enables a more flexible frontend.
This commit is contained in:
parent
87bd5e62f2
commit
039d7775ed
11
src/NzbDrone.Core/Qualities/QualityDefinitionLimits.cs
Normal file
11
src/NzbDrone.Core/Qualities/QualityDefinitionLimits.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace NzbDrone.Core.Qualities;
|
||||
|
||||
[SuppressMessage("Performance", "CA1822:Mark members as static", Justification =
|
||||
"Serializable properties of a DTO")]
|
||||
public record QualityDefinitionLimits
|
||||
{
|
||||
public int MinLimit => 0;
|
||||
public int MaxLimit => 1000;
|
||||
}
|
@ -17,6 +17,7 @@ namespace NzbDrone.Core.Qualities
|
||||
List<QualityDefinition> All();
|
||||
QualityDefinition GetById(int id);
|
||||
QualityDefinition Get(Quality quality);
|
||||
QualityDefinitionLimits GetLimits();
|
||||
}
|
||||
|
||||
public class QualityDefinitionService : IQualityDefinitionService, IExecute<ResetQualityDefinitionsCommand>, IHandle<ApplicationStartedEvent>
|
||||
@ -64,6 +65,11 @@ namespace NzbDrone.Core.Qualities
|
||||
return GetAll()[quality];
|
||||
}
|
||||
|
||||
public QualityDefinitionLimits GetLimits()
|
||||
{
|
||||
return new QualityDefinitionLimits();
|
||||
}
|
||||
|
||||
private void InsertMissingDefinitions()
|
||||
{
|
||||
var insertList = new List<QualityDefinition>();
|
||||
|
@ -55,6 +55,12 @@ namespace Sonarr.Api.V3.Qualities
|
||||
.ToResource());
|
||||
}
|
||||
|
||||
[HttpGet("limits")]
|
||||
public ActionResult<QualityDefinitionLimits> GetLimits()
|
||||
{
|
||||
return Ok(_qualityDefinitionService.GetLimits());
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
public void Handle(CommandExecutedEvent message)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user