change the communication protocol to RMQ

This commit is contained in:
Volodymyr Smirnov
2020-10-26 16:20:47 +02:00
parent b6c3cb4131
commit 29156b7f10
25 changed files with 439 additions and 173 deletions

View File

@@ -1,4 +1,5 @@
using System.Threading.Tasks;
using MalwareMultiScan.Api.Data.Models;
using MalwareMultiScan.Api.Services;
using MalwareMultiScan.Shared.Data.Responses;
using Microsoft.AspNetCore.Http;
@@ -11,21 +12,23 @@ namespace MalwareMultiScan.Api.Controllers
[Produces("application/json")]
public class ScanResultsController : Controller
{
private readonly ScanResultsService _scanResultsService;
private readonly ScanResultService _scanResultService;
public ScanResultsController(ScanResultsService scanResultsService)
public ScanResultsController(ScanResultService scanResultService)
{
_scanResultsService = scanResultsService;
_scanResultService = scanResultService;
}
[HttpPost("{id}")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
public async Task<IActionResult> Index(string id, [FromBody] ResultResponse result)
[HttpGet("{id}")]
[ProducesResponseType(typeof(ScanResult), StatusCodes.Status200OK)]
public async Task<IActionResult> Index(string id)
{
await _scanResultsService.UpdateScanResultForBackend(
id, result.Backend, true, result.Success, result.Threats);
return NoContent();
var scanResult = await _scanResultService.GetScanResult(id);
if (scanResult == null)
return NotFound();
return Ok(scanResult);
}
}
}