mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-06-23 15:30:34 -04:00
39 lines
877 B
C#
39 lines
877 B
C#
using Kyoo.Controllers;
|
|
using Kyoo.Models;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
namespace Kyoo.Api
|
|
{
|
|
[Route("api/libraries")]
|
|
[ApiController]
|
|
public class LibrariesController : ControllerBase
|
|
{
|
|
private readonly ILibraryManager _libraryManager;
|
|
|
|
public LibrariesController(ILibraryManager libraryManager)
|
|
{
|
|
_libraryManager = libraryManager;
|
|
}
|
|
|
|
[HttpGet]
|
|
public IEnumerable<Library> GetLibraries()
|
|
{
|
|
return _libraryManager.GetLibraries();
|
|
}
|
|
|
|
[HttpGet("{librarySlug}")]
|
|
[Authorize(Policy="Read")]
|
|
public ActionResult<IEnumerable<Show>> GetShows(string librarySlug)
|
|
{
|
|
Library library = _libraryManager.GetLibrary(librarySlug);
|
|
|
|
if (library == null)
|
|
return NotFound();
|
|
|
|
return _libraryManager.GetShowsInLibrary(library.ID).ToList();
|
|
}
|
|
}
|
|
} |