forked from ddrilling/AsbCloudServer
Получение списков ограничивающих параметров и подсистем
This commit is contained in:
parent
6ef633d607
commit
29d4121440
@ -19,6 +19,12 @@ namespace AsbCloudApp.Services
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<LimitingParameterDto>> GetStatAsync(LimitingParameterRequest request, CancellationToken token);
|
||||
|
||||
/// <summary>
|
||||
/// Получение списка ограничений
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Dictionary<int, string> GetLimitingParameteraNames();
|
||||
}
|
||||
#nullable disable
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
{
|
||||
private readonly ILimitingParameterRepository limitingParameterRepository;
|
||||
private readonly IWellService wellService;
|
||||
private readonly Dictionary<int, string> feedRegulatorData = new Dictionary<int, string>()
|
||||
private readonly Dictionary<int, string> feedRegulatorData = new ()
|
||||
{
|
||||
{ 0, "Нет ограничения" },
|
||||
{ 1, "МСП" },
|
||||
@ -63,6 +63,11 @@ namespace AsbCloudInfrastructure.Services
|
||||
return result;
|
||||
}
|
||||
|
||||
public Dictionary<int, string> GetLimitingParameteraNames() //TODO: Перенести получение ограничений в репозиторий
|
||||
{
|
||||
return feedRegulatorData;
|
||||
}
|
||||
|
||||
private IEnumerable<LimitingParameterDataDto> TrimLimitingParameters(IEnumerable<LimitingParameterDataDto> data, LimitingParameterRequest request)
|
||||
{
|
||||
var result = data.Select((x) =>
|
||||
|
@ -40,6 +40,18 @@ namespace AsbCloudWebApi.Controllers
|
||||
return Ok(subsystemResult);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получение словаря названий ограничений
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("names")]
|
||||
[ProducesResponseType(typeof(Dictionary<int, string>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public IActionResult GetLimitingParameteraNames()
|
||||
{
|
||||
var feedRegulatorData = limitingParameterService.GetLimitingParameteraNames();
|
||||
return Ok(feedRegulatorData);
|
||||
}
|
||||
|
||||
protected async Task<bool> UserHasAccesToWellAsync(int idWell, CancellationToken token)
|
||||
{
|
||||
var idCompany = User.GetCompanyId();
|
||||
|
@ -3,7 +3,6 @@ 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;
|
||||
@ -25,6 +24,14 @@ namespace AsbCloudWebApi.Controllers.Subsystems
|
||||
private readonly ISubsystemOperationTimeService subsystemOperationTimeService;
|
||||
private readonly IWellService wellService;
|
||||
private readonly ISubsystemService subsystemService;
|
||||
|
||||
private readonly Dictionary<int, string> subsystemNames = new()
|
||||
{
|
||||
{ 1, "SAUB" },
|
||||
{ 65537, "Torque Master" },
|
||||
{ 65536, "Spin Master" }
|
||||
};
|
||||
|
||||
public SubsystemOperationTimeController(ISubsystemOperationTimeService subsystemOperationTimeService, IWellService wellService, ISubsystemService subsystemService)
|
||||
{
|
||||
this.subsystemOperationTimeService = subsystemOperationTimeService;
|
||||
@ -131,6 +138,17 @@ namespace AsbCloudWebApi.Controllers.Subsystems
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получение словаря названий подсистем
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("names")]
|
||||
[ProducesResponseType(typeof(Dictionary<int, string>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public IActionResult GetSubsystemsNames()
|
||||
{
|
||||
return Ok(subsystemNames);
|
||||
}
|
||||
|
||||
protected async Task<bool> UserHasAccesToWellAsync(int idWell, CancellationToken token)
|
||||
{
|
||||
var idCompany = User.GetCompanyId();
|
||||
|
Loading…
Reference in New Issue
Block a user