forked from ddrilling/AsbCloudServer
Added Permission attribute to non-anonymous controller methods
This commit is contained in:
parent
f5ec155bbb
commit
b46a7c33a2
@ -19,6 +19,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
{}
|
||||
|
||||
[HttpGet("Autogenerated")]
|
||||
[Permission]
|
||||
public IActionResult GetAutogenerated()
|
||||
{
|
||||
var controllers = Assembly.GetExecutingAssembly().GetTypes().
|
||||
|
@ -28,6 +28,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("/merge/{idFrom}/{idTo}")]
|
||||
[Permission]
|
||||
public async Task<IActionResult> MergeTelemetriesAsync(int idFrom, int idTo, CancellationToken token = default)
|
||||
{
|
||||
var count = await telemetryService.MergeAsync(idFrom, idTo, token)
|
||||
|
@ -17,6 +17,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
}
|
||||
|
||||
[HttpPost("EnshureTimezonesIsSet")]
|
||||
[Permission]
|
||||
public IActionResult EnsureTimestamps()
|
||||
{
|
||||
((IWellService)service).EnshureTimezonesIsSet();
|
||||
|
@ -81,6 +81,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns code="200">Ок</returns>
|
||||
[Authorize]
|
||||
[HttpPut("{idUser}/ChangePassword")]
|
||||
[Permission]
|
||||
public IActionResult ChangePassword([FromRoute]int idUser, [FromBody]string newPassword)
|
||||
{
|
||||
const string roleName = "Администратор";
|
||||
|
@ -29,6 +29,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns></returns>
|
||||
[HttpGet()]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<ClusterDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetClustersAsync(CancellationToken token = default)
|
||||
{
|
||||
@ -49,6 +50,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{idCluster}")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<WellDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetWellsAsync(int idCluster, CancellationToken token = default)
|
||||
{
|
||||
|
@ -29,6 +29,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<DepositDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetDepositsAsync(CancellationToken token = default)
|
||||
{
|
||||
@ -48,6 +49,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("drillParamsWells")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<DepositDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetDepositsDrillParamsAsync(CancellationToken token = default)
|
||||
{
|
||||
@ -68,6 +70,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{depositId}")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<ClusterDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetClustersAsync(int depositId,
|
||||
CancellationToken token = default)
|
||||
|
@ -37,6 +37,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns> Список параметров для коридоров бурения </returns>
|
||||
[HttpGet]
|
||||
[Route("api/well/{idWell}/drillFlowChart")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<DrillFlowChartDto>), (int) System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetAsync(int idWell, DateTime updateFrom = default,
|
||||
CancellationToken token = default)
|
||||
@ -85,6 +86,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("api/well/{idWell}/drillFlowChart")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(int), (int) System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> InsertAsync(int idWell,
|
||||
DrillFlowChartDto drillFlowChartDto, CancellationToken token = default)
|
||||
@ -109,6 +111,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("api/well/{idWell}/drillFlowChart/range")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(int), (int) System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> InsertRangeAsync(int idWell,
|
||||
IEnumerable<DrillFlowChartDto> drillFlowChartParams, CancellationToken token = default)
|
||||
@ -134,6 +137,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
[Route("api/well/{idWell}/drillFlowChart")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(int), (int) System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> EditAsync(int idWell,
|
||||
DrillFlowChartDto drillFlowChart, CancellationToken token = default)
|
||||
@ -159,6 +163,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpDelete]
|
||||
[Route("api/well/{idWell}/drillFlowChart")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(int), (int) System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> DeleteAsync(int idWell,
|
||||
int drillFlowChartParamsId, CancellationToken token = default)
|
||||
|
@ -33,6 +33,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns> Значения по умолчанию для режимов бурения </returns>
|
||||
[HttpGet("autoParams")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(DrillParamsDto), (int) System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetDefaultAsync(int idWell,
|
||||
double startDepth, double endDepth, CancellationToken token = default)
|
||||
@ -56,6 +57,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns> Список параметров для режимов бурения на скважине </returns>
|
||||
[HttpGet]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<DrillParamsDto>), (int) System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetAllAsync(int idWell,
|
||||
CancellationToken token = default)
|
||||
@ -79,6 +81,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(int), (int) System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> InsertAsync(int idWell,
|
||||
DrillParamsDto drillParamsDto, CancellationToken token = default)
|
||||
@ -102,6 +105,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("range")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(int), (int) System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> InsertRangeAsync(int idWell,
|
||||
IEnumerable<DrillParamsDto> drillParams, CancellationToken token = default)
|
||||
@ -126,6 +130,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"></param>
|
||||
/// <returns>кол-во затронутых изменениями записей</returns>
|
||||
[HttpPost("save")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> SaveAsync(int idWell, IEnumerable<DrillParamsDto> drillParams, CancellationToken token = default)
|
||||
{
|
||||
@ -150,6 +155,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(int), (int) System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> UpdateAsync(int idWell, int dtoId,
|
||||
DrillParamsDto drillParamsDto, CancellationToken token = default)
|
||||
@ -174,6 +180,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(int), (int) System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> DeleteAsync(int idWell,
|
||||
int drillParamsId, CancellationToken token = default)
|
||||
@ -197,6 +204,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns> Список параметров для режимов бурения на композитной скважине </returns>
|
||||
[HttpGet("composite")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<DrillParamsDto>), (int) System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetCompositeAllAsync(int idWell, CancellationToken token = default)
|
||||
{
|
||||
|
@ -32,6 +32,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns> Возвращает файл программы бурения </returns>
|
||||
[HttpGet]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(FileResult), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetAsync(int idWell, CancellationToken token = default)
|
||||
{
|
||||
@ -64,6 +65,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns> Возвращает ссылку на файл программы бурения в облаке </returns>
|
||||
[HttpGet("webUrl")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(string), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetOrCreateSharedUrlAsync(int idWell, [FromServices]IFileShareService fileShareService, CancellationToken token = default)
|
||||
{
|
||||
@ -91,6 +93,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("fileMark")]
|
||||
[Permission]
|
||||
public async Task<IActionResult> CreateFileMarkAsync(int idWell, FileMarkDto markDto, CancellationToken token = default)
|
||||
{
|
||||
var idCompany = User.GetCompanyId();
|
||||
@ -116,6 +119,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("fileMark")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> DeleteFileMarkAsync(int idWell, int idMark,
|
||||
CancellationToken token = default)
|
||||
|
@ -34,6 +34,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> SaveFilesAsync(int idWell, int idCategory,
|
||||
[FromForm] IFormFileCollection files, CancellationToken token = default)
|
||||
@ -79,6 +80,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns>Список информации о файлах в этой категории</returns>
|
||||
[HttpGet]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(PaginationContainer<FileInfoDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetFilesInfoAsync(
|
||||
[FromRoute] int idWell,
|
||||
@ -112,6 +114,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns>Запрашиваемый файл</returns>
|
||||
[HttpGet]
|
||||
[Route("{fileId}")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetFileAsync([FromRoute] int idWell,
|
||||
int fileId, CancellationToken token = default)
|
||||
@ -149,6 +152,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token">Токен отмены задачи </param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{idFile}")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> DeleteAsync(int idWell, int idFile,
|
||||
CancellationToken token = default)
|
||||
@ -172,6 +176,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token">Токен отмены задачи </param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("fileMark")]
|
||||
[Permission]
|
||||
public async Task<IActionResult> CreateFileMarkAsync(int idWell, FileMarkDto markDto, CancellationToken token = default)
|
||||
{
|
||||
var idCompany = User.GetCompanyId();
|
||||
@ -197,6 +202,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token">Токен отмены задачи </param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("fileMark")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> DeleteFileMarkAsync(int idWell, int idMark,
|
||||
CancellationToken token = default)
|
||||
|
@ -22,6 +22,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Permission]
|
||||
[Route("categories")]
|
||||
public async Task<IActionResult> GetCategoriesAsync([FromRoute] int idWell, CancellationToken token = default)
|
||||
{
|
||||
@ -33,6 +34,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Permission]
|
||||
[Route("last/{idCategory}")]
|
||||
public async Task<IActionResult> GetLastAsync([FromRoute] int idWell, [FromRoute] int idCategory, CancellationToken token = default)
|
||||
{
|
||||
@ -51,6 +53,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Permission]
|
||||
[Route("history")]
|
||||
public async Task<IActionResult> GetHisoryAsync([FromRoute] int idWell, int? idCategory = null, CancellationToken token = default)
|
||||
{
|
||||
@ -62,6 +65,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Permission]
|
||||
public async Task<IActionResult> InsertAsync([FromRoute] int idWell, MeasureDto data, CancellationToken token = default)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||
@ -72,6 +76,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
}
|
||||
|
||||
[HttpPut]
|
||||
[Permission]
|
||||
public async Task<IActionResult> UpdateAsync([FromRoute] int idWell, MeasureDto data, CancellationToken token = default)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||
@ -82,6 +87,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
}
|
||||
|
||||
[HttpDelete]
|
||||
[Permission]
|
||||
[Route("history/{idData}")]
|
||||
public async Task<IActionResult> MarkAsDeleteAsync([FromRoute] int idWell, [FromRoute] int idData, CancellationToken token = default)
|
||||
{
|
||||
|
@ -34,6 +34,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token">Токен для отмены задачи</param>
|
||||
/// <returns>список сообщений по скважине</returns>
|
||||
[HttpGet]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(PaginationContainer<MessageDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetMessagesAsync(int idWell, int skip = 0, int take = 32,
|
||||
[FromQuery] IEnumerable<int> categoryids = default,
|
||||
@ -62,6 +63,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns>список сообщений по скважине</returns>
|
||||
[HttpGet]
|
||||
[Route("datesRange")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(DatesRangeDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetMessagesDateRangeAsync(int idWell, CancellationToken token = default)
|
||||
{
|
||||
|
@ -33,6 +33,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"></param>
|
||||
/// <returns>Возвращает данные по среднему и максимальному МСП на кусту</returns>
|
||||
[HttpGet("well/{idWell}/ropStat")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(ClusterRopStatDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetClusterRopStatByIdWellAsync([FromRoute] int idWell,
|
||||
CancellationToken token = default)
|
||||
@ -72,6 +73,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("cluster/{idCluster}/stat")] // TODO: Это статистика кластера, перенести в ClusterOperationStatController
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(StatClusterDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetStatClusterAsync(int idCluster,
|
||||
CancellationToken token = default)
|
||||
@ -98,6 +100,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("wellsStats")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<StatWellDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetWellsStatAsync([FromQuery]IEnumerable<int> idWells, CancellationToken token = default)
|
||||
{
|
||||
@ -115,6 +118,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("well/{idWell}/stat")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(StatWellDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetStatWellAsync(int idWell,
|
||||
CancellationToken token = default)
|
||||
@ -135,6 +139,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("well/{idWell}/tvd")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<PlanFactPredictBase<WellOperationDto>>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetTvdAsync(int idWell,
|
||||
CancellationToken token = default)
|
||||
|
@ -42,6 +42,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token">Токен для отмены задачи</param>
|
||||
/// <returns>id фоновой задачи формирования отчета</returns>
|
||||
[HttpPost]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> CreateReportAsync(int idWell, int stepSeconds, int format,
|
||||
DateTime begin = default, DateTime end = default,
|
||||
@ -80,6 +81,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token">Токен для отмены задачи</param>
|
||||
/// <returns>Список имен существующих отчетов (отчетов)</returns>
|
||||
[HttpGet]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<string>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetAllReportsNamesByWellAsync(int idWell, CancellationToken token = default)
|
||||
{
|
||||
@ -109,6 +111,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns>прогнозируемое кол-во страниц отчета</returns>
|
||||
[HttpGet]
|
||||
[Route("reportSize")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(string), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetReportSizeAsync(int idWell,
|
||||
int stepSeconds, int format, DateTime begin = default,
|
||||
@ -137,6 +140,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns>Даты самого старого и самого свежего отчетов в БД</returns>
|
||||
[HttpGet]
|
||||
[Route("datesRange")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(DatesRangeDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetReportsDateRangeAsync(int idWell, CancellationToken token = default)
|
||||
{
|
||||
|
@ -24,6 +24,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="take">от 1 до 1000</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Permission]
|
||||
public IActionResult GetAll(int take = 512)
|
||||
{
|
||||
var result = service.GetAll(take);
|
||||
@ -36,6 +37,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="take">от 1 до 1000</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("fast")]
|
||||
[Permission]
|
||||
public IActionResult GetFast(int take = 512)
|
||||
{
|
||||
var result = service.GetFast(take);
|
||||
@ -48,6 +50,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="take">от 1 до 1000</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("slow")]
|
||||
[Permission]
|
||||
public IActionResult GetSlow(int take = 512)
|
||||
{
|
||||
var result = service.GetSlow(take);
|
||||
@ -60,6 +63,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="take">от 1 до 1000</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("error")]
|
||||
[Permission]
|
||||
public IActionResult GetError(int take = 512)
|
||||
{
|
||||
var result = service.GetError(take);
|
||||
@ -72,7 +76,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="take">от 1 до 1000</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("users")]
|
||||
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<RequestLogUserDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public IActionResult GetUsersStat(int take = 512)
|
||||
{
|
||||
|
@ -48,6 +48,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("api/well/{idWell}/setpoints")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> InsertAsync(int idWell, SetpointsRequestDto setpoints, CancellationToken token = default)
|
||||
{
|
||||
@ -86,6 +87,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("api/well/{idWell}/setpoints")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<SetpointsRequestDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetByIdWellAsync([FromRoute] int idWell, CancellationToken token = default)
|
||||
{
|
||||
@ -147,6 +149,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"></param>
|
||||
/// <returns>1 - удалено, 0 и меньше - не удалено</returns>
|
||||
[HttpDelete("api/well/{idWell}/setpoints/{id}")]
|
||||
[Permission]
|
||||
public async Task<IActionResult> TryDeleteByIdWellAsync(int idWell, int id, CancellationToken token = default)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
|
@ -37,6 +37,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns>Список операций на скважине за все время</returns>
|
||||
[HttpGet]
|
||||
[Route("operationsByWell")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(PaginationContainer<TelemetryOperationDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetOperationsByWellAsync(int idWell, int skip = 0, int take = 32,
|
||||
[FromQuery] IEnumerable<int> categoryIds = default, DateTime begin = default, DateTime end = default,
|
||||
@ -65,6 +66,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns>Коллекцию данных по скважине "глубина-день"</returns>
|
||||
[HttpGet]
|
||||
[Route("wellDepthToDay")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<WellDepthToDayDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetWellDepthToDayAsync(int idWell,
|
||||
CancellationToken token = default)
|
||||
@ -94,6 +96,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns>Коллекцию данных по глубине скважины за период</returns>
|
||||
[HttpGet]
|
||||
[Route("wellDepthToInterval")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<WellDepthToIntervalDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetWellDepthToIntervalAsync(int idWell,
|
||||
int intervalSeconds, int shiftStartSec, CancellationToken token = default)
|
||||
@ -123,6 +126,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns>Коллекцию операций на скважине</returns>
|
||||
[HttpGet]
|
||||
[Route("operationsSummary")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<TelemetryOperationDurationDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetOperationsSummaryAsync(int idWell, DateTime begin = default,
|
||||
DateTime end = default, CancellationToken token = default)
|
||||
@ -152,6 +156,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns>Коллекцию операций на скважине</returns>
|
||||
[HttpGet]
|
||||
[Route("operationsToInterval")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<TelemetryOperationDurationDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetOperationsToIntervalAsync(int idWell,
|
||||
int intervalSeconds, int workBeginSeconds, CancellationToken token = default)
|
||||
@ -179,6 +184,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns>Даты самой первой и самой последней операций на скважине</returns>
|
||||
[HttpGet]
|
||||
[Route("datesRange")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(DatesRangeDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetOperationsDateRangeAsync(int idWell, CancellationToken token = default)
|
||||
{
|
||||
|
@ -47,6 +47,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("{uid}/info")]
|
||||
[Permission]
|
||||
public async Task<IActionResult> PostInfoAsync(string uid, [FromBody] TelemetryInfoDto info,
|
||||
CancellationToken token = default)
|
||||
{
|
||||
@ -63,6 +64,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("{uid}/timezone")]
|
||||
[Permission]
|
||||
public async Task<IActionResult> UpdateTimeZoneAsync(string uid, SimpleTimezoneDto timezone,
|
||||
CancellationToken token = default)
|
||||
{
|
||||
@ -80,6 +82,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("{uid}/message")]
|
||||
[Permission]
|
||||
public async Task<IActionResult> PostMessagesAsync(string uid, [FromBody] IEnumerable<TelemetryMessageDto> dtos,
|
||||
CancellationToken token = default)
|
||||
{
|
||||
@ -102,6 +105,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("{uid}/event")]
|
||||
[Permission]
|
||||
public async Task<IActionResult> PostEventsAsync(string uid, [FromBody] List<EventDto> events,
|
||||
CancellationToken token = default)
|
||||
{
|
||||
@ -118,6 +122,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("{uid}/user")]
|
||||
[Permission]
|
||||
public IActionResult PostUsers(string uid, [FromBody] List<TelemetryUserDto> users)
|
||||
{
|
||||
telemetryUserService.Upsert(uid, users);
|
||||
|
@ -71,6 +71,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token">Токен завершения задачи</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{idWell}")]
|
||||
[Permission]
|
||||
public virtual async Task<ActionResult<TDto>> GetDataAsync(int idWell, DateTime begin = default,
|
||||
int intervalSec = 600, int approxPointsCount = 1024, CancellationToken token = default)
|
||||
{
|
||||
@ -99,6 +100,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("{idWell}/datesRange")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(DatesRangeDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public virtual async Task<IActionResult> GetDataDatesRangeAsync(int idWell,
|
||||
CancellationToken token = default)
|
||||
|
@ -29,6 +29,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<WellCompositeDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetAsync(int idWell, CancellationToken token = default)
|
||||
{
|
||||
@ -47,6 +48,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Permission]
|
||||
public async Task<IActionResult> SaveAsync(int idWell, IEnumerable<WellCompositeDto> wellComposites, CancellationToken token = default)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||
|
@ -27,6 +27,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns>Список скважин</returns>
|
||||
[HttpGet]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<WellDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetWellsAsync(CancellationToken token = default)
|
||||
{
|
||||
@ -53,6 +54,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns>Информация о требуемой скважине </returns>
|
||||
[HttpGet("{idWell}")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(WellDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetAsync(int idWell, CancellationToken token = default)
|
||||
{
|
||||
@ -77,6 +79,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns></returns>
|
||||
[HttpPut("{idWell}")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> UpdateWellAsync(int idWell, WellDto dto,
|
||||
CancellationToken token = default)
|
||||
|
@ -36,6 +36,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("sectionTypes")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IDictionary<int, string>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public IActionResult GetSectionTypes()
|
||||
{
|
||||
@ -50,6 +51,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("categories")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<WellOperationCategoryDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public IActionResult GetCategories()
|
||||
{
|
||||
@ -73,6 +75,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"></param>
|
||||
/// <returns>Список операций на скважине в контейнере для постраничного просмотра</returns>
|
||||
[HttpGet]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(PaginationContainer<WellOperationDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetOperationsAsync(
|
||||
[FromRoute] int idWell,
|
||||
@ -115,6 +118,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns>Нужную операцию на скважине</returns>
|
||||
[HttpGet]
|
||||
[Route("{idOperation}")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(WellOperationDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetAsync(int idWell, int idOperation,
|
||||
CancellationToken token = default)
|
||||
@ -134,6 +138,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token">Токен отмены задачи</param>
|
||||
/// <returns>Количество добавленных в БД строк</returns>
|
||||
[HttpPost]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<WellOperationDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> InsertRangeAsync(int idWell, [FromBody] IEnumerable<WellOperationDto> values,
|
||||
CancellationToken token = default)
|
||||
@ -155,6 +160,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token">Токен отмены задачи</param>
|
||||
/// <returns>Количество обновленных в БД строк</returns>
|
||||
[HttpPut("{idOperation}")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(WellOperationDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> UpdateAsync(int idWell, int idOperation,
|
||||
[FromBody] WellOperationDto value, CancellationToken token = default)
|
||||
@ -175,6 +181,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token">Токен отмены задачи</param>
|
||||
/// <returns>Количество удаленных из БД строк</returns>
|
||||
[HttpDelete("{idOperation}")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> DeleteAsync(int idWell, int idOperation, CancellationToken token = default)
|
||||
{
|
||||
@ -198,6 +205,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Permission]
|
||||
[Route("import/{options}")]
|
||||
public async Task<IActionResult> ImportAsync(int idWell,
|
||||
[FromForm] IFormFileCollection files,
|
||||
@ -242,6 +250,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns>Запрашиваемый файл</returns>
|
||||
[HttpGet]
|
||||
[Route("export")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> ExportAsync([FromRoute] int idWell, CancellationToken token = default)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user