mirror of
https://github.com/zoriya/Kyoo.git
synced 2026-01-08 13:10:34 -05:00
42 lines
800 B
C#
42 lines
800 B
C#
using Kyoo.Models;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System.Collections.Generic;
|
|
using Kyoo.Controllers;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
namespace Kyoo.Api
|
|
{
|
|
[Route("api/shows")]
|
|
[Route("api/show")]
|
|
[ApiController]
|
|
public class ShowsController : ControllerBase
|
|
{
|
|
private readonly ILibraryManager _libraryManager;
|
|
|
|
public ShowsController(ILibraryManager libraryManager)
|
|
{
|
|
_libraryManager = libraryManager;
|
|
}
|
|
|
|
[HttpGet]
|
|
[Authorize]
|
|
public IEnumerable<Show> GetShows()
|
|
{
|
|
return _libraryManager.GetShows();
|
|
}
|
|
|
|
[HttpGet("{slug}")]
|
|
[Authorize(Policy="Read")]
|
|
[JsonDetailed]
|
|
public ActionResult<Show> GetShow(string slug)
|
|
{
|
|
Show show = _libraryManager.GetShowBySlug(slug);
|
|
|
|
if (show == null)
|
|
return NotFound();
|
|
|
|
return show;
|
|
}
|
|
}
|
|
}
|