mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 05:53:33 -07:00
Fix validation for boolean query parameters
(cherry picked from commit 2fecd280016630d5afe2d60e52cbb52338c155b5) Closes #3671
This commit is contained in:
parent
0dcfb9eec8
commit
1fb31a4c9c
2 changed files with 3 additions and 12 deletions
|
@ -2,7 +2,6 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
using Lidarr.Http;
|
using Lidarr.Http;
|
||||||
using Lidarr.Http.Extensions;
|
|
||||||
using Lidarr.Http.REST.Attributes;
|
using Lidarr.Http.REST.Attributes;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
|
@ -139,11 +138,8 @@ namespace Lidarr.Api.V1.Albums
|
||||||
}
|
}
|
||||||
|
|
||||||
[RestDeleteById]
|
[RestDeleteById]
|
||||||
public void DeleteAlbum(int id)
|
public void DeleteAlbum(int id, bool deleteFiles = false, bool addImportListExclusion = false)
|
||||||
{
|
{
|
||||||
var deleteFiles = Request.GetBooleanQueryParameter("deleteFiles");
|
|
||||||
var addImportListExclusion = Request.GetBooleanQueryParameter("addImportListExclusion");
|
|
||||||
|
|
||||||
_albumService.DeleteAlbum(id, deleteFiles, addImportListExclusion);
|
_albumService.DeleteAlbum(id, deleteFiles, addImportListExclusion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
using Lidarr.Http;
|
using Lidarr.Http;
|
||||||
using Lidarr.Http.Extensions;
|
|
||||||
using Lidarr.Http.REST;
|
using Lidarr.Http.REST;
|
||||||
using Lidarr.Http.REST.Attributes;
|
using Lidarr.Http.REST.Attributes;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
@ -156,9 +155,8 @@ namespace Lidarr.Api.V1.Artist
|
||||||
}
|
}
|
||||||
|
|
||||||
[RestPutById]
|
[RestPutById]
|
||||||
public ActionResult<ArtistResource> UpdateArtist(ArtistResource artistResource)
|
public ActionResult<ArtistResource> UpdateArtist(ArtistResource artistResource, bool moveFiles = false)
|
||||||
{
|
{
|
||||||
var moveFiles = Request.GetBooleanQueryParameter("moveFiles");
|
|
||||||
var artist = _artistService.GetArtist(artistResource.Id);
|
var artist = _artistService.GetArtist(artistResource.Id);
|
||||||
|
|
||||||
var sourcePath = artist.Path;
|
var sourcePath = artist.Path;
|
||||||
|
@ -183,11 +181,8 @@ namespace Lidarr.Api.V1.Artist
|
||||||
}
|
}
|
||||||
|
|
||||||
[RestDeleteById]
|
[RestDeleteById]
|
||||||
public void DeleteArtist(int id)
|
public void DeleteArtist(int id, bool deleteFiles = false, bool addImportListExclusion = false)
|
||||||
{
|
{
|
||||||
var deleteFiles = Request.GetBooleanQueryParameter("deleteFiles");
|
|
||||||
var addImportListExclusion = Request.GetBooleanQueryParameter("addImportListExclusion");
|
|
||||||
|
|
||||||
_artistService.DeleteArtist(id, deleteFiles, addImportListExclusion);
|
_artistService.DeleteArtist(id, deleteFiles, addImportListExclusion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue