forked from ddrilling/AsbCloudServer
Added Get well by id method in WellController
This commit is contained in:
parent
4968ca4382
commit
167dd3d5f5
@ -96,11 +96,15 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
.ThenInclude(c => c.Deposit)
|
.ThenInclude(c => c.Deposit)
|
||||||
.FirstOrDefaultAsync(w => w.Id == idWell, token)
|
.FirstOrDefaultAsync(w => w.Id == idWell, token)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
var dto = entity.Adapt<WellDto>();
|
var dto = entity.Adapt<WellDto>();
|
||||||
|
|
||||||
|
if (dto is null)
|
||||||
|
return dto;
|
||||||
|
|
||||||
dto.Cluster = entity.Cluster?.Caption;
|
dto.Cluster = entity.Cluster?.Caption;
|
||||||
dto.Deposit = entity.Cluster?.Deposit?.Caption;
|
dto.Deposit = entity.Cluster?.Deposit?.Caption;
|
||||||
|
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
public async Task<string> GetWellCaptionByIdAsync(int idWell, CancellationToken token)
|
public async Task<string> GetWellCaptionByIdAsync(int idWell, CancellationToken token)
|
||||||
|
@ -46,6 +46,27 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
return Ok(wells);
|
return Ok(wells);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Возвращает информацию о требуемой скважине
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="idWell"> Id требуемой скважины </param>
|
||||||
|
/// <param name="token"> Токен отмены задачи </param>
|
||||||
|
/// <returns>Информация о требуемой скважине </returns>
|
||||||
|
[HttpGet("getWell")]
|
||||||
|
[ProducesResponseType(typeof(WellDto), (int)System.Net.HttpStatusCode.OK)]
|
||||||
|
public async Task<IActionResult> GetAsync(int idWell, CancellationToken token = default)
|
||||||
|
{
|
||||||
|
var idCompany = User.GetCompanyId();
|
||||||
|
|
||||||
|
if (idCompany is null)
|
||||||
|
return NoContent();
|
||||||
|
|
||||||
|
var well = await wellService.GetAsync(idWell,
|
||||||
|
token).ConfigureAwait(false);
|
||||||
|
|
||||||
|
return Ok(well);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Возвращает список скважин, передающих телеметрию в данный момент
|
/// Возвращает список скважин, передающих телеметрию в данный момент
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user