forked from ddrilling/AsbCloudServer
41 lines
1.2 KiB
C#
41 lines
1.2 KiB
C#
using AsbCloudApp.Data;
|
|
using AsbCloudApp.Services;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace AsbCloudWebApi.Controllers
|
|
{
|
|
/// <summary>
|
|
/// Редактор телеметрий для админки
|
|
/// </summary>
|
|
[Route("api/admin/telemetry")]
|
|
[ApiController]
|
|
[Authorize]
|
|
public class AdminTelemetryController : CrudController<TelemetryDto, ICrudRepository<TelemetryDto>>
|
|
{
|
|
private readonly ITelemetryService telemetryService;
|
|
|
|
public AdminTelemetryController(ICrudRepository<TelemetryDto> service,
|
|
ITelemetryService telemetryService)
|
|
: base(service)
|
|
{
|
|
this.telemetryService = telemetryService;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Merge telemetries. No body required.
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpPost("/merge/{idFrom}/{idTo}")]
|
|
[Permission]
|
|
public async Task<IActionResult> MergeTelemetriesAsync(int idFrom, int idTo, CancellationToken token)
|
|
{
|
|
var count = await telemetryService.MergeAsync(idFrom, idTo, token)
|
|
.ConfigureAwait(false);
|
|
return Ok(count);
|
|
}
|
|
}
|
|
}
|