forked from ddrilling/AsbCloudServer
91 lines
3.2 KiB
C#
91 lines
3.2 KiB
C#
using AsbCloudApp.Data.Subsystems;
|
|
using AsbCloudApp.Requests;
|
|
using AsbCloudApp.Services;
|
|
using AsbCloudApp.Services.Subsystems;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System.Collections.Generic;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace AsbCloudWebApi.Controllers.Subsystems
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
/// Наработка подсистем
|
|
/// </summary>
|
|
[Route("api/[controller]")]
|
|
[ApiController]
|
|
[Authorize]
|
|
|
|
public class SubsystemOperationTimeController : ControllerBase
|
|
{
|
|
private readonly ISubsystemOperationTimeService subsystemOperationTimeService;
|
|
private readonly IWellService wellService;
|
|
|
|
public SubsystemOperationTimeController(ISubsystemOperationTimeService subsystemOperationTimeService, IWellService wellService)
|
|
{
|
|
this.subsystemOperationTimeService = subsystemOperationTimeService;
|
|
this.wellService = wellService;
|
|
}
|
|
/// <summary>
|
|
/// получить статистику
|
|
/// </summary>
|
|
[HttpGet("stat")]
|
|
[ProducesResponseType(typeof(IEnumerable<SubsystemStatisticsDto>), (int)System.Net.HttpStatusCode.OK)]
|
|
public async Task<IActionResult> GetStatisticsAsync(CancellationToken token = default)
|
|
{
|
|
var subsystemResult = new List<SubsystemStatisticsDto>()
|
|
{
|
|
|
|
};
|
|
|
|
return Ok(subsystemResult);
|
|
}
|
|
|
|
/// <summary>
|
|
/// получить список подсистем общий.
|
|
/// </summary>
|
|
[HttpGet("subsystem")]
|
|
[ProducesResponseType(typeof(IEnumerable<SubsystemDto>), (int)System.Net.HttpStatusCode.OK)]
|
|
public async Task<IActionResult> GetSubsystemAsync([FromQuery] int idWell, CancellationToken token = default)
|
|
{
|
|
var result = await subsystemOperationTimeService.GetSubsystemAsync(idWell, token);
|
|
return Ok(result);
|
|
}
|
|
|
|
/// <summary>
|
|
/// получить список наработок подсистем
|
|
/// </summary>
|
|
[HttpGet("operationTime")]
|
|
[ProducesResponseType(typeof(IEnumerable<SubsystemOperationTimeDto>), (int)System.Net.HttpStatusCode.OK)]
|
|
public async Task<IActionResult> GetOperationTimeAsync(
|
|
[FromQuery] SubsystemOperationTimeRequest request,
|
|
CancellationToken token = default)
|
|
{
|
|
|
|
var result = await subsystemOperationTimeService.GetOperationTimeAsync(request, token);
|
|
return Ok(result);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Удалить наработки.
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <param name="token"></param>
|
|
/// <returns></returns>
|
|
[HttpDelete]
|
|
[Permission]
|
|
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
|
public async Task<IActionResult> DeleteAsync(
|
|
[FromQuery] SubsystemOperationTimeRequest request,
|
|
CancellationToken token)
|
|
{
|
|
var result = await subsystemOperationTimeService.DeleteAsync(request, token);
|
|
return Ok(result);
|
|
}
|
|
}
|
|
}
|