32 lines
1.0 KiB
C#
32 lines
1.0 KiB
C#
using dy.net.model.dto;
|
|
using dy.net.service;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace dy.net.Controllers
|
|
{
|
|
[Route("api/video/exclusions")]
|
|
[ApiController]
|
|
[Authorize]
|
|
public class VideoExclusionsController : ControllerBase
|
|
{
|
|
private readonly VideoExclusionService _service;
|
|
|
|
public VideoExclusionsController(VideoExclusionService service) => _service = service;
|
|
|
|
[HttpGet]
|
|
public async Task<IActionResult> List([FromQuery] VideoExclusionPageRequest request) =>
|
|
ApiResult.Success(await _service.GetPageAsync(request));
|
|
|
|
[HttpPost("unexclude")]
|
|
public async Task<IActionResult> Unexclude([FromBody] UnexcludeVideosRequest request)
|
|
{
|
|
try { return ApiResult.Success(await _service.UnexcludeAsync(request)); }
|
|
catch (Exception ex) when (ex is InvalidOperationException or KeyNotFoundException)
|
|
{
|
|
return ApiResult.Fail(ex.Message);
|
|
}
|
|
}
|
|
}
|
|
}
|