DD.WellWorkover.Cloud/AsbCloudWebApi/Controllers/AdminTelemetryController.cs

48 lines
1.4 KiB
C#
Raw Normal View History

2021-09-10 11:28:57 +05:00
using AsbCloudApp.Data;
using AsbCloudApp.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
2021-09-29 10:12:54 +05:00
using System.Collections.Generic;
using System.Linq;
2021-09-10 11:28:57 +05:00
namespace AsbCloudWebApi.Controllers
{
[Route("api/admin/telemetry")]
[ApiController]
[Authorize]
public class AdminTelemetryController : CrudController<TelemetryDto, ICrudService<TelemetryDto>>
{
2021-09-29 10:12:54 +05:00
private readonly ITelemetryService telemetryService;
public AdminTelemetryController(ICrudService<TelemetryDto> service,
ITelemetryService telemetryService)
2021-09-10 11:28:57 +05:00
: base(service)
{
service.Incledes.Add("Well");
2021-09-29 10:12:54 +05:00
this.telemetryService = telemetryService;
}
[HttpGet]
[Route("/reduntentUids")]
public IActionResult GetRedundentRemoteUids()
{
var result = telemetryService.GetRedundentRemoteUids().Select(i => new { i.Key, ids = i.Item2 });
return Ok(result);
}
/// <summary>
/// merge telemetries
/// </summary>
/// <param name="telemetriesIds">array of ids</param>
/// <returns></returns>
[HttpPost]
[Route("/merge")]
public IActionResult MergeTelemetries([FromBody] List<int> telemetriesIds)
{
var count = telemetryService.Merge(telemetriesIds);
return Ok(count);
2021-09-10 11:28:57 +05:00
}
}
}