Split BackgroundWorkController

This commit is contained in:
ngfrolov 2023-10-10 13:45:48 +05:00
parent d7aea0f583
commit c5ee0eeb39
Signed by untrusted user who does not match committer: ng.frolov
GPG Key ID: E99907A0357B29A7

View File

@ -9,17 +9,16 @@ namespace AsbCloudWebApi.Controllers
[Route("api/[controller]")]
[Authorize]
[ApiController]
public class BackgroundWork : ControllerBase
public class BackgroundWorkController : ControllerBase
{
private readonly BackgroundWorker backgroundWorker;
public BackgroundWork(BackgroundWorker backgroundWorker)
public BackgroundWorkController(BackgroundWorker backgroundWorker)
{
this.backgroundWorker = backgroundWorker;
}
[HttpGet]
//[ProducesResponseType(typeof(IEnumerable<DepositDto>), (int)System.Net.HttpStatusCode.OK)]
public IActionResult GetAll()
{
var result = new {
@ -30,5 +29,19 @@ namespace AsbCloudWebApi.Controllers
};
return Ok(result);
}
[HttpGet("Current")]
public IActionResult GetCurrent()
{
var result = (BackgroundWorkDto?)backgroundWorker.CurrentWork;
return Ok(result);
}
[HttpGet("Failed")]
public IActionResult GetFelled()
{
var result = backgroundWorker.WorkStore.Felled.Select(work => (BackgroundWorkDto)work);
return Ok(result);
}
}
}