diff --git a/AsbCloudWebApi/Controllers/TelemetryInfoController.cs b/AsbCloudWebApi/Controllers/TelemetryInfoController.cs new file mode 100644 index 00000000..b8c5cd5a --- /dev/null +++ b/AsbCloudWebApi/Controllers/TelemetryInfoController.cs @@ -0,0 +1,50 @@ +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using AsbCloudApp.Data.SAUB; +using AsbCloudApp.Requests; +using AsbCloudApp.Services; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; + +namespace AsbCloudWebApi.Controllers; + +/// +/// Информация о телеметрии +/// +[Route("api/[controller]")] +[ApiController] +[Authorize] +public class TelemetryInfoController : ControllerBase +{ + private readonly ITelemetryService telemetryService; + + public TelemetryInfoController(ITelemetryService telemetryService) + { + this.telemetryService = telemetryService; + } + + /// + /// Получить список информации о телеметрии + /// + /// + /// + /// + [HttpGet] + [Permission] + [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] + public async Task GetAsync([FromQuery] TelemetryInfoRequestBase request, CancellationToken token) + { + var idCompany = User.GetCompanyId(); + + if (!idCompany.HasValue) + return Forbid(); + + var requestToService = new TelemetryInfoRequest(idCompany.Value, request); + + var telemetriesInfo = await telemetryService.GetInfoAsync(requestToService, token); + + return Ok(telemetriesInfo); + } +} \ No newline at end of file