Fix validation for boolean query parameters

This commit is contained in:
Bogdan 2023-05-14 10:20:28 +03:00 committed by Mark McDowall
parent 5de7322d60
commit 2fecd28001
2 changed files with 3 additions and 9 deletions

View File

@ -62,10 +62,8 @@ namespace Sonarr.Api.V3.Episodes
[HttpPut("monitor")] [HttpPut("monitor")]
[Consumes("application/json")] [Consumes("application/json")]
public IActionResult SetEpisodesMonitored([FromBody] EpisodesMonitoredResource resource) public IActionResult SetEpisodesMonitored([FromBody] EpisodesMonitoredResource resource, [FromQuery] bool includeImages = false)
{ {
var includeImages = Request.GetBooleanQueryParameter("includeImages", false);
if (resource.EpisodeIds.Count == 1) if (resource.EpisodeIds.Count == 1)
{ {
_episodeService.SetEpisodeMonitored(resource.EpisodeIds.First(), resource.Monitored); _episodeService.SetEpisodeMonitored(resource.EpisodeIds.First(), resource.Monitored);

View File

@ -138,9 +138,8 @@ namespace Sonarr.Api.V3.Series
[RestPutById] [RestPutById]
[Consumes("application/json")] [Consumes("application/json")]
public ActionResult<SeriesResource> UpdateSeries(SeriesResource seriesResource) public ActionResult<SeriesResource> UpdateSeries(SeriesResource seriesResource, bool moveFiles = false)
{ {
var moveFiles = Request.GetBooleanQueryParameter("moveFiles");
var series = _seriesService.GetSeries(seriesResource.Id); var series = _seriesService.GetSeries(seriesResource.Id);
if (moveFiles) if (moveFiles)
@ -167,11 +166,8 @@ namespace Sonarr.Api.V3.Series
} }
[RestDeleteById] [RestDeleteById]
public void DeleteSeries(int id) public void DeleteSeries(int id, bool deleteFiles = false, bool addImportListExclusion = false)
{ {
var deleteFiles = Request.GetBooleanQueryParameter("deleteFiles");
var addImportListExclusion = Request.GetBooleanQueryParameter("addImportListExclusion");
_seriesService.DeleteSeries(new List<int> { id }, deleteFiles, addImportListExclusion); _seriesService.DeleteSeries(new List<int> { id }, deleteFiles, addImportListExclusion);
} }