diff --git a/AsbCloudInfrastructure/Services/WellService.cs b/AsbCloudInfrastructure/Services/WellService.cs index 54a95cbe..cd194caa 100644 --- a/AsbCloudInfrastructure/Services/WellService.cs +++ b/AsbCloudInfrastructure/Services/WellService.cs @@ -96,11 +96,15 @@ namespace AsbCloudInfrastructure.Services .ThenInclude(c => c.Deposit) .FirstOrDefaultAsync(w => w.Id == idWell, token) .ConfigureAwait(false); - + var dto = entity.Adapt(); + + if (dto is null) + return dto; + dto.Cluster = entity.Cluster?.Caption; dto.Deposit = entity.Cluster?.Deposit?.Caption; - + return dto; } public async Task GetWellCaptionByIdAsync(int idWell, CancellationToken token) diff --git a/AsbCloudWebApi/Controllers/WellController.cs b/AsbCloudWebApi/Controllers/WellController.cs index 2590671f..364d0863 100644 --- a/AsbCloudWebApi/Controllers/WellController.cs +++ b/AsbCloudWebApi/Controllers/WellController.cs @@ -46,6 +46,27 @@ namespace AsbCloudWebApi.Controllers return Ok(wells); } + /// + /// Возвращает информацию о требуемой скважине + /// + /// Id требуемой скважины + /// Токен отмены задачи + /// Информация о требуемой скважине + [HttpGet("getWell")] + [ProducesResponseType(typeof(WellDto), (int)System.Net.HttpStatusCode.OK)] + public async Task 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); + } + /// /// Возвращает список скважин, передающих телеметрию в данный момент ///