Merge pull request #4027 from cvium/fix_update_libraryoptions
Fix model binding in UpdateLibraryOptions
This commit is contained in:
commit
1f4deccfa4
|
@ -76,7 +76,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
[FromQuery] string? name,
|
[FromQuery] string? name,
|
||||||
[FromQuery] string? collectionType,
|
[FromQuery] string? collectionType,
|
||||||
[FromQuery] string[] paths,
|
[FromQuery] string[] paths,
|
||||||
[FromBody] LibraryOptionsDto? libraryOptionsDto,
|
[FromBody] AddVirtualFolderDto? libraryOptionsDto,
|
||||||
[FromQuery] bool refreshLibrary = false)
|
[FromQuery] bool refreshLibrary = false)
|
||||||
{
|
{
|
||||||
var libraryOptions = libraryOptionsDto?.LibraryOptions ?? new LibraryOptions();
|
var libraryOptions = libraryOptionsDto?.LibraryOptions ?? new LibraryOptions();
|
||||||
|
@ -312,19 +312,17 @@ namespace Jellyfin.Api.Controllers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update library options.
|
/// Update library options.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">The library name.</param>
|
/// <param name="request">The library name and options.</param>
|
||||||
/// <param name="libraryOptions">The library options.</param>
|
|
||||||
/// <response code="204">Library updated.</response>
|
/// <response code="204">Library updated.</response>
|
||||||
/// <returns>A <see cref="NoContentResult"/>.</returns>
|
/// <returns>A <see cref="NoContentResult"/>.</returns>
|
||||||
[HttpPost("LibraryOptions")]
|
[HttpPost("LibraryOptions")]
|
||||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
public ActionResult UpdateLibraryOptions(
|
public ActionResult UpdateLibraryOptions(
|
||||||
[FromQuery] string? id,
|
[FromBody] UpdateLibraryOptionsDto request)
|
||||||
[FromBody] LibraryOptions? libraryOptions)
|
|
||||||
{
|
{
|
||||||
var collectionFolder = (CollectionFolder)_libraryManager.GetItemById(id);
|
var collectionFolder = (CollectionFolder)_libraryManager.GetItemById(request.Id);
|
||||||
|
|
||||||
collectionFolder.UpdateLibraryOptions(libraryOptions);
|
collectionFolder.UpdateLibraryOptions(request.LibraryOptions);
|
||||||
return NoContent();
|
return NoContent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,13 +3,13 @@
|
||||||
namespace Jellyfin.Api.Models.LibraryStructureDto
|
namespace Jellyfin.Api.Models.LibraryStructureDto
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Library options dto.
|
/// Add virtual folder dto.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class LibraryOptionsDto
|
public class AddVirtualFolderDto
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets library options.
|
/// Gets or sets library options.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public LibraryOptions? LibraryOptions { get; set; }
|
public LibraryOptions? LibraryOptions { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
using System;
|
||||||
|
using MediaBrowser.Model.Configuration;
|
||||||
|
|
||||||
|
namespace Jellyfin.Api.Models.LibraryStructureDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Update library options dto.
|
||||||
|
/// </summary>
|
||||||
|
public class UpdateLibraryOptionsDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the library item id.
|
||||||
|
/// </summary>
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets library options.
|
||||||
|
/// </summary>
|
||||||
|
public LibraryOptions? LibraryOptions { get; set; }
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user