using AsbCloudApp.Data;
using AsbCloudApp.Services;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace AsbCloudWebApi.Controllers
{
///
/// Контроллер сбора данных от буровых
///
[Route("api/telemetry")]
[ApiController]
public class TelemetryController : ControllerBase
{
private readonly ITelemetryService telemetryService;
public TelemetryController(ITelemetryService telemetryService)
{
this.telemetryService = telemetryService;
}
///
/// Принимает общую информацию по скважине
///
///
[HttpPost]
[Route("{uid}/info")]
public IActionResult Info(string uid, [FromBody] TelemetryInfoDto info)
{
telemetryService.UpdateInfo(uid, info);
return Ok();
}
///
/// Принимает данные от разных систем по скважине
///
///
[HttpPost]
[Route("{uid}/data")]
public IActionResult Data(string uid, [FromBody] TelemetryDataDto data)
{
telemetryService.UpdateData(uid, data);
return Ok();
}
}
}