aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/Controllers/FilterController.cs
diff options
context:
space:
mode:
authorcrobibero <cody@robibe.ro>2020-12-01 11:07:41 -0700
committercrobibero <cody@robibe.ro>2020-12-01 11:07:41 -0700
commitc083b29e292c72b65929ea05639e3b5a8a401037 (patch)
tree68c48427a88ade6acdef401aff3a03324099273d /Jellyfin.Api/Controllers/FilterController.cs
parentf660969e6c5bd3fc8b3898277e1f8d23d557816e (diff)
Use Guid as API parameter type where possible
Diffstat (limited to 'Jellyfin.Api/Controllers/FilterController.cs')
-rw-r--r--Jellyfin.Api/Controllers/FilterController.cs24
1 files changed, 12 insertions, 12 deletions
diff --git a/Jellyfin.Api/Controllers/FilterController.cs b/Jellyfin.Api/Controllers/FilterController.cs
index 31cb9e273..7b3111cff 100644
--- a/Jellyfin.Api/Controllers/FilterController.cs
+++ b/Jellyfin.Api/Controllers/FilterController.cs
@@ -50,13 +50,13 @@ namespace Jellyfin.Api.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
public ActionResult<QueryFiltersLegacy> GetQueryFiltersLegacy(
[FromQuery] Guid? userId,
- [FromQuery] string? parentId,
+ [FromQuery] Guid? parentId,
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] includeItemTypes,
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] mediaTypes)
{
- var parentItem = string.IsNullOrEmpty(parentId)
- ? null
- : _libraryManager.GetItemById(parentId);
+ var parentItem = parentId.HasValue
+ ? _libraryManager.GetItemById(parentId.Value)
+ : null;
var user = userId.HasValue && !userId.Equals(Guid.Empty)
? _userManager.GetUserById(userId.Value)
@@ -71,11 +71,11 @@ namespace Jellyfin.Api.Controllers
parentItem = null;
}
- var item = string.IsNullOrEmpty(parentId)
- ? user == null
+ var item = parentId.HasValue
+ ? parentItem
+ : user == null
? _libraryManager.RootFolder
- : _libraryManager.GetUserRootFolder()
- : parentItem;
+ : _libraryManager.GetUserRootFolder();
var query = new InternalItemsQuery
{
@@ -140,7 +140,7 @@ namespace Jellyfin.Api.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
public ActionResult<QueryFilters> GetQueryFilters(
[FromQuery] Guid? userId,
- [FromQuery] string? parentId,
+ [FromQuery] Guid? parentId,
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] includeItemTypes,
[FromQuery] bool? isAiring,
[FromQuery] bool? isMovie,
@@ -150,9 +150,9 @@ namespace Jellyfin.Api.Controllers
[FromQuery] bool? isSeries,
[FromQuery] bool? recursive)
{
- var parentItem = string.IsNullOrEmpty(parentId)
- ? null
- : _libraryManager.GetItemById(parentId);
+ var parentItem = parentId.HasValue
+ ? _libraryManager.GetItemById(parentId.Value)
+ : null;
var user = userId.HasValue && !userId.Equals(Guid.Empty)
? _userManager.GetUserById(userId.Value)