Fix validation for boolean query parameters

(cherry picked from commit 2fecd280016630d5afe2d60e52cbb52338c155b5)

Closes #2493
pull/2497/head
Bogdan 2 years ago
parent 43367504a4
commit 19eec0cb88

@ -19,7 +19,6 @@ using NzbDrone.Core.Validation.Paths;
using NzbDrone.Http.REST.Attributes; using NzbDrone.Http.REST.Attributes;
using NzbDrone.SignalR; using NzbDrone.SignalR;
using Readarr.Http; using Readarr.Http;
using Readarr.Http.Extensions;
using Readarr.Http.REST; using Readarr.Http.REST;
namespace Readarr.Api.V1.Author namespace Readarr.Api.V1.Author
@ -143,9 +142,8 @@ namespace Readarr.Api.V1.Author
} }
[RestPutById] [RestPutById]
public ActionResult<AuthorResource> UpdateAuthor(AuthorResource authorResource) public ActionResult<AuthorResource> UpdateAuthor(AuthorResource authorResource, bool moveFiles = false)
{ {
var moveFiles = Request.GetBooleanQueryParameter("moveFiles");
var author = _authorService.GetAuthor(authorResource.Id); var author = _authorService.GetAuthor(authorResource.Id);
if (moveFiles) if (moveFiles)
@ -172,10 +170,8 @@ namespace Readarr.Api.V1.Author
} }
[RestDeleteById] [RestDeleteById]
public void DeleteAuthor(int id) public void DeleteAuthor(int id, bool deleteFiles = false, bool addImportListExclusion = false)
{ {
var deleteFiles = Request.GetBooleanQueryParameter("deleteFiles");
var addImportListExclusion = Request.GetBooleanQueryParameter("addImportListExclusion");
_authorService.DeleteAuthor(id, deleteFiles, addImportListExclusion); _authorService.DeleteAuthor(id, deleteFiles, addImportListExclusion);
} }

@ -19,7 +19,6 @@ using NzbDrone.Core.Validation.Paths;
using NzbDrone.Http.REST.Attributes; using NzbDrone.Http.REST.Attributes;
using NzbDrone.SignalR; using NzbDrone.SignalR;
using Readarr.Http; using Readarr.Http;
using Readarr.Http.Extensions;
namespace Readarr.Api.V1.Books namespace Readarr.Api.V1.Books
{ {
@ -176,11 +175,8 @@ namespace Readarr.Api.V1.Books
} }
[RestDeleteById] [RestDeleteById]
public void DeleteBook(int id) public void DeleteBook(int id, bool deleteFiles = false, bool addImportListExclusion = false)
{ {
var deleteFiles = Request.GetBooleanQueryParameter("deleteFiles");
var addImportListExclusion = Request.GetBooleanQueryParameter("addImportListExclusion");
_bookService.DeleteBook(id, deleteFiles, addImportListExclusion); _bookService.DeleteBook(id, deleteFiles, addImportListExclusion);
} }

Loading…
Cancel
Save