forked from ddrilling/AsbCloudServer
52 lines
1.4 KiB
C#
52 lines
1.4 KiB
C#
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
|
||
{
|
||
/// <summary>
|
||
/// Контроллер сбора данных от буровых
|
||
/// </summary>
|
||
[Route("api/telemetry")]
|
||
[ApiController]
|
||
public class TelemetryController : ControllerBase
|
||
{
|
||
private readonly ITelemetryService telemetryService;
|
||
|
||
public TelemetryController(ITelemetryService telemetryService)
|
||
{
|
||
this.telemetryService = telemetryService;
|
||
}
|
||
|
||
/// <summary>
|
||
/// Принимает общую информацию по скважине
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost]
|
||
[Route("{uid}/info")]
|
||
public IActionResult Info(string uid, [FromBody] TelemetryInfoDto info)
|
||
{
|
||
telemetryService.UpdateInfo(uid, info);
|
||
return Ok();
|
||
}
|
||
|
||
/// <summary>
|
||
/// Принимает данные от разных систем по скважине
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost]
|
||
[Route("{uid}/data")]
|
||
public IActionResult Data(string uid, [FromBody] TelemetryDataDto data)
|
||
{
|
||
telemetryService.UpdateData(uid, data);
|
||
return Ok();
|
||
}
|
||
|
||
}
|
||
}
|