Moving the crawler reference to the Controller Call

This commit is contained in:
Zoe Roux 2020-02-10 22:23:07 +01:00
parent d28f976d2b
commit 7b080ce0df

View File

@ -1,10 +1,5 @@
using Kyoo.Controllers; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks;
namespace Kyoo.Controllers namespace Kyoo.Controllers
{ {
@ -12,15 +7,8 @@ namespace Kyoo.Controllers
[ApiController] [ApiController]
public class AdminController : ControllerBase public class AdminController : ControllerBase
{ {
private readonly ICrawler crawler; [HttpGet("scan")]
public IActionResult ScanLibrary(ICrawler crawler)
public AdminController(ICrawler crawler)
{
this.crawler = crawler;
}
[HttpGet("scan")]
public IActionResult ScanLibrary()
{ {
crawler.StartAsync(new CancellationToken()); crawler.StartAsync(new CancellationToken());
return Ok("Scanning"); return Ok("Scanning");