basic skeleton for the API and queueing

This commit is contained in:
Volodymyr Smirnov
2020-10-25 16:11:36 +02:00
parent 96695664e0
commit b6c3cb4131
28 changed files with 374 additions and 190 deletions

View File

@@ -0,0 +1,31 @@
using System.Threading.Tasks;
using MalwareMultiScan.Api.Services;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace MalwareMultiScan.Api.Controllers
{
[Route("download")]
public class DownloadController : Controller
{
private readonly ScanResultsService _scanResultsService;
public DownloadController(ScanResultsService scanResultsService)
{
_scanResultsService = scanResultsService;
}
[HttpGet("{id}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
public async Task<IActionResult> Index(string id)
{
var fileStream = await _scanResultsService.ObtainFile(id);
if (fileStream == null)
return NotFound();
return File(fileStream, "application/octet-stream");
}
}
}