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 VersionController : ControllerBase { private readonly ITelemetryService telemetryService; public VersionController(ITelemetryService telemetryService) { this.telemetryService = telemetryService; } /// /// Получить список версий ПО /// /// /// /// [HttpGet] [Permission] [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] public async Task GetAsync([FromQuery] VersionRequestBase request, CancellationToken token) { var idCompany = User.GetCompanyId(); if (!idCompany.HasValue) return Forbid(); var requestToService = new VersionRequest(idCompany.Value, request); var version = await telemetryService.GetVersionsAsync(requestToService, token); return Ok(version); } }