ReportController.cs 783 B

123456789101112131415161718192021222324252627
  1. using CallCenter.Devices;
  2. using Microsoft.AspNetCore.Authorization;
  3. using Microsoft.AspNetCore.Mvc;
  4. using Microsoft.Extensions.Options;
  5. namespace CallCenter.Api.Controllers;
  6. [ApiController]
  7. [Route("api/report")]
  8. public class ReportController : ControllerBase
  9. {
  10. private readonly IOptionsSnapshot<DeviceConfigs> _options;
  11. private readonly IDeviceEventHandler _deviceEventHandler;
  12. public ReportController(IOptionsSnapshot<DeviceConfigs> options, IDeviceEventHandler deviceEventHandler)
  13. {
  14. _options = options;
  15. _deviceEventHandler = deviceEventHandler;
  16. }
  17. [AllowAnonymous]
  18. [HttpGet]
  19. public async Task ReceiveEvents()
  20. {
  21. await _deviceEventHandler.HandleAsync(Request.Body, _options.Value, HttpContext.RequestAborted);
  22. }
  23. }