Рефакторинг контроллеров

This commit is contained in:
Степанов Дмитрий 2023-10-12 16:03:34 +05:00
parent 6556a03bb5
commit 53e1e07ca0
5 changed files with 102 additions and 99 deletions

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using AsbCloudApp.Data;
using AsbCloudApp.Data.ProcessMaps; using AsbCloudApp.Data.ProcessMaps;
using AsbCloudApp.Exceptions; using AsbCloudApp.Exceptions;
using AsbCloudApp.Repositories; using AsbCloudApp.Repositories;
@ -17,8 +18,8 @@ namespace AsbCloudWebApi.Controllers.ProcessMaps;
[ApiController] [ApiController]
[Route("api/well/{idWell}/[controller]")] [Route("api/well/{idWell}/[controller]")]
[Authorize] [Authorize]
public abstract class ProcessMapBaseController<TProcessMap> : ControllerBase public abstract class ProcessMapBaseController<T> : ControllerBase
where TProcessMap : ProcessMapBaseDto where T : ProcessMapPlanBaseDto
{ {
protected int IdUser protected int IdUser
{ {
@ -33,17 +34,21 @@ public abstract class ProcessMapBaseController<TProcessMap> : ControllerBase
} }
} }
protected readonly IWellService wellService; private readonly IWellService wellService;
protected readonly IRepositoryWellRelated<TProcessMap> repository; private readonly IUserRepository userRepository;
protected readonly IUserRepository userRepository; private readonly ICrudRepository<WellSectionTypeDto> wellSectionRepository;
protected readonly IRepositoryWellRelated<T> repository;
protected ProcessMapBaseController(IWellService wellService, protected ProcessMapBaseController(IWellService wellService,
IRepositoryWellRelated<TProcessMap> repository, IProcessMapPlanRepository<T> repository,
IUserRepository userRepository) IUserRepository userRepository,
ICrudRepository<WellSectionTypeDto> wellSectionRepository)
{ {
this.wellService = wellService; this.wellService = wellService;
this.repository = repository; this.repository = repository;
this.userRepository = userRepository; this.userRepository = userRepository;
this.wellSectionRepository = wellSectionRepository;
} }
/// <summary> /// <summary>
@ -56,13 +61,15 @@ public abstract class ProcessMapBaseController<TProcessMap> : ControllerBase
[HttpPost] [HttpPost]
[ProducesResponseType(typeof(int), StatusCodes.Status200OK)] [ProducesResponseType(typeof(int), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)]
public virtual async Task<IActionResult> InsertAsync(TProcessMap processMap, int idWell, CancellationToken cancellationToken) public virtual async Task<IActionResult> InsertAsync(T processMap, int idWell, CancellationToken cancellationToken)
{ {
processMap.IdWell = idWell; processMap.IdWell = idWell;
processMap.IdUser = IdUser; processMap.IdUser = IdUser;
processMap.LastUpdate = DateTime.UtcNow; processMap.LastUpdate = DateTime.UtcNow;
await AssertUserHasAccessToEditProcessMapAsync(processMap.IdWell, cancellationToken); await CheckIsExistsWellSectionTypeAsync(processMap.IdWellSectionType, cancellationToken);
await AssertUserHasAccessToEditProcessMapAsync(processMap.IdWell, cancellationToken);
var result = await repository.InsertAsync(processMap, cancellationToken); var result = await repository.InsertAsync(processMap, cancellationToken);
@ -79,17 +86,19 @@ public abstract class ProcessMapBaseController<TProcessMap> : ControllerBase
[HttpPut] [HttpPut]
[ProducesResponseType(typeof(int), StatusCodes.Status200OK)] [ProducesResponseType(typeof(int), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)]
public virtual async Task<IActionResult> UpdateAsync(TProcessMap processMap, int idWell, CancellationToken cancellationToken) public virtual async Task<IActionResult> UpdateAsync(T processMap, int idWell, CancellationToken cancellationToken)
{ {
processMap.IdWell = idWell; processMap.IdWell = idWell;
processMap.IdUser = IdUser; processMap.IdUser = IdUser;
processMap.LastUpdate = DateTime.UtcNow; processMap.LastUpdate = DateTime.UtcNow;
await AssertUserHasAccessToEditProcessMapAsync(idWell, cancellationToken); await CheckIsExistsWellSectionTypeAsync(processMap.IdWellSectionType, cancellationToken);
await AssertUserHasAccessToEditProcessMapAsync(idWell, cancellationToken);
var result = await repository.UpdateAsync(processMap, cancellationToken); var result = await repository.UpdateAsync(processMap, cancellationToken);
if (result == ICrudRepository<TProcessMap>.ErrorIdNotFound) if (result == ICrudRepository<T>.ErrorIdNotFound)
return this.ValidationBadRequest(nameof(processMap.Id), $"РТК с Id: {processMap.Id} не существует"); return this.ValidationBadRequest(nameof(processMap.Id), $"РТК с Id: {processMap.Id} не существует");
return Ok(result); return Ok(result);
@ -98,17 +107,18 @@ public abstract class ProcessMapBaseController<TProcessMap> : ControllerBase
/// <summary> /// <summary>
/// Удаление РТК /// Удаление РТК
/// </summary> /// </summary>
/// <param name="id">Id удаляемой РТК</param>
/// <param name="idWell">Id скважины</param> /// <param name="idWell">Id скважины</param>
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
[HttpDelete] [HttpDelete]
[ProducesResponseType(typeof(int), StatusCodes.Status200OK)] [ProducesResponseType(typeof(int), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)]
public virtual async Task<IActionResult> DeleteAsync(int idWell, CancellationToken cancellationToken) public virtual async Task<IActionResult> DeleteAsync(int id, int idWell, CancellationToken cancellationToken)
{ {
await AssertUserHasAccessToEditProcessMapAsync(idWell, cancellationToken); await AssertUserHasAccessToEditProcessMapAsync(idWell, cancellationToken);
var result = await repository.DeleteAsync(idWell, cancellationToken); var result = await repository.DeleteAsync(id, cancellationToken);
return Ok(result); return Ok(result);
} }
@ -128,8 +138,7 @@ public abstract class ProcessMapBaseController<TProcessMap> : ControllerBase
return Ok(processMaps); return Ok(processMaps);
} }
protected virtual async Task AssertUserHasAccessToEditProcessMapAsync(int idWell, protected async Task AssertUserHasAccessToEditProcessMapAsync(int idWell, CancellationToken cancellationToken)
CancellationToken cancellationToken)
{ {
var well = await wellService.GetOrDefaultAsync(idWell, cancellationToken) var well = await wellService.GetOrDefaultAsync(idWell, cancellationToken)
?? throw new ArgumentInvalidException(nameof(idWell),$"Скважины с {idWell} не существует"); ?? throw new ArgumentInvalidException(nameof(idWell),$"Скважины с {idWell} не существует");
@ -140,7 +149,15 @@ public abstract class ProcessMapBaseController<TProcessMap> : ControllerBase
!await wellService.IsCompanyInvolvedInWellAsync(idCompany.Value, idWell, cancellationToken)) !await wellService.IsCompanyInvolvedInWellAsync(idCompany.Value, idWell, cancellationToken))
throw new ForbidException("Нет доступа к скважине"); throw new ForbidException("Нет доступа к скважине");
if (well.IdState == 2 && !userRepository.HasPermission(IdUser, "WellDrillingProcessMap.editCompletedWell")) if (well.IdState == 2 && !userRepository.HasPermission(IdUser, "ProcessMap.editCompletedWell"))
throw new ForbidException("Недостаточно прав для редактирования РТК завершенной скважины"); throw new ForbidException("Недостаточно прав для редактирования РТК завершенной скважины");
} }
private async Task CheckIsExistsWellSectionTypeAsync(int idWellSectionType, CancellationToken cancellationToken)
{
var wellSection = await wellSectionRepository.GetOrDefaultAsync(idWellSectionType, cancellationToken);
if (wellSection is null)
throw new ArgumentInvalidException(nameof(ProcessMapPlanWellDrillingDto.IdWellSectionType), $"Тип секции с Id: {idWellSectionType} не найден");
}
} }

View File

@ -16,30 +16,28 @@ using Microsoft.AspNetCore.SignalR;
namespace AsbCloudWebApi.Controllers.ProcessMaps; namespace AsbCloudWebApi.Controllers.ProcessMaps;
public class WellDrillingProcessMapController : ProcessMapBaseController<WellDrillingProcessMapDto> public class ProcessMapWellDrillingController : ProcessMapBaseController<ProcessMapPlanWellDrillingDto>
{ {
private readonly IHubContext<TelemetryHub> telemetryHubContext; private readonly IHubContext<TelemetryHub> telemetryHubContext;
private readonly IWellDrillingProcessMapReportService wellDrillingProcessMapReportService; private readonly IProcessMapReportWellDrillingService wellDrillingProcessMapReportService;
private readonly IProcessMapReportExportService wellDrillingProcessMapReportExportService; private readonly IProcessMapReportExportService wellDrillingProcessMapReportExportService;
private readonly IProcessMapImportService wellDrillingProcessMapImportService; private readonly IProcessMapImportService wellDrillingProcessMapImportService;
private readonly ICrudRepository<WellSectionTypeDto> wellSectionRepository;
public WellDrillingProcessMapController(IWellService wellService, public ProcessMapWellDrillingController(IWellService wellService,
IWellDrillingProcessMapRepository repository, IProcessMapPlanRepository<ProcessMapPlanWellDrillingDto> repository,
IUserRepository userRepository, IUserRepository userRepository,
IHubContext<TelemetryHub> telemetryHubContext, IHubContext<TelemetryHub> telemetryHubContext,
IProcessMapReportExportService wellDrillingProcessMapReportExportService, IProcessMapReportExportService wellDrillingProcessMapReportExportService,
IProcessMapImportService wellDrillingProcessMapImportService, IProcessMapImportService wellDrillingProcessMapImportService,
IWellDrillingProcessMapReportService wellDrillingProcessMapReportService, IProcessMapReportWellDrillingService wellDrillingProcessMapReportService,
ICrudRepository<WellSectionTypeDto> wellSectionRepository) ICrudRepository<WellSectionTypeDto> wellSectionRepository)
: base(wellService, repository, userRepository) : base(wellService, repository, userRepository, wellSectionRepository)
{ {
this.telemetryHubContext = telemetryHubContext; this.telemetryHubContext = telemetryHubContext;
this.wellDrillingProcessMapReportExportService = wellDrillingProcessMapReportExportService; this.wellDrillingProcessMapReportExportService = wellDrillingProcessMapReportExportService;
this.wellDrillingProcessMapImportService = wellDrillingProcessMapImportService; this.wellDrillingProcessMapImportService = wellDrillingProcessMapImportService;
this.wellDrillingProcessMapReportService = wellDrillingProcessMapReportService; this.wellDrillingProcessMapReportService = wellDrillingProcessMapReportService;
this.wellSectionRepository = wellSectionRepository;
} }
/// <summary> /// <summary>
@ -49,11 +47,8 @@ public class WellDrillingProcessMapController : ProcessMapBaseController<WellDri
/// <param name="idWell">Id скважины</param> /// <param name="idWell">Id скважины</param>
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
public override async Task<IActionResult> InsertAsync(WellDrillingProcessMapDto processMap, int idWell, public override async Task<IActionResult> InsertAsync(ProcessMapPlanWellDrillingDto processMap, int idWell, CancellationToken cancellationToken)
CancellationToken cancellationToken)
{ {
await CheckIsExistsWellSectionTypeAsync(processMap.IdWellSectionType, cancellationToken);
var result = await base.InsertAsync(processMap, idWell, cancellationToken); var result = await base.InsertAsync(processMap, idWell, cancellationToken);
await NotifyUsersBySignalR(idWell, cancellationToken); await NotifyUsersBySignalR(idWell, cancellationToken);
@ -68,11 +63,8 @@ public class WellDrillingProcessMapController : ProcessMapBaseController<WellDri
/// <param name="idWell">Id скважины</param> /// <param name="idWell">Id скважины</param>
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
public override async Task<IActionResult> UpdateAsync(WellDrillingProcessMapDto processMap, int idWell, public override async Task<IActionResult> UpdateAsync(ProcessMapPlanWellDrillingDto processMap, int idWell, CancellationToken cancellationToken)
CancellationToken cancellationToken)
{ {
await CheckIsExistsWellSectionTypeAsync(processMap.IdWellSectionType, cancellationToken);
var result = await base.UpdateAsync(processMap, idWell, cancellationToken); var result = await base.UpdateAsync(processMap, idWell, cancellationToken);
await NotifyUsersBySignalR(idWell, cancellationToken); await NotifyUsersBySignalR(idWell, cancellationToken);
@ -83,12 +75,13 @@ public class WellDrillingProcessMapController : ProcessMapBaseController<WellDri
/// <summary> /// <summary>
/// Удаление РТК /// Удаление РТК
/// </summary> /// </summary>
/// <param name="id">Id удаляемой РТК</param>
/// <param name="idWell">Id скважины</param> /// <param name="idWell">Id скважины</param>
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
public override async Task<IActionResult> DeleteAsync(int idWell, CancellationToken cancellationToken) public override async Task<IActionResult> DeleteAsync(int id, int idWell, CancellationToken cancellationToken)
{ {
var result = await base.DeleteAsync(idWell, cancellationToken); var result = await base.DeleteAsync(id, idWell, cancellationToken);
await NotifyUsersBySignalR(idWell, cancellationToken); await NotifyUsersBySignalR(idWell, cancellationToken);
@ -102,7 +95,7 @@ public class WellDrillingProcessMapController : ProcessMapBaseController<WellDri
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
[HttpGet("report")] [HttpGet("report")]
[ProducesResponseType(typeof(WellDrillingProcessMapDto), StatusCodes.Status200OK)] [ProducesResponseType(typeof(ProcessMapPlanWellDrillingDto), StatusCodes.Status200OK)]
public async Task<IActionResult> GetReportAsync(int idWell, CancellationToken cancellationToken) public async Task<IActionResult> GetReportAsync(int idWell, CancellationToken cancellationToken)
{ {
var report = await wellDrillingProcessMapReportService.GetAsync(idWell, cancellationToken); var report = await wellDrillingProcessMapReportService.GetAsync(idWell, cancellationToken);
@ -139,9 +132,9 @@ public class WellDrillingProcessMapController : ProcessMapBaseController<WellDri
/// <returns></returns> /// <returns></returns>
[HttpPost("import/{options}")] [HttpPost("import/{options}")]
[ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)]
public async Task<IActionResult> ImportAsync(int idWell, public async Task<IActionResult> ImportAsync(int idWell,
int options, int options,
[Required] IFormFile file, [Required] IFormFile file,
CancellationToken cancellationToken) CancellationToken cancellationToken)
{ {
await AssertUserHasAccessToEditProcessMapAsync(idWell, cancellationToken); await AssertUserHasAccessToEditProcessMapAsync(idWell, cancellationToken);
@ -158,7 +151,9 @@ public class WellDrillingProcessMapController : ProcessMapBaseController<WellDri
(options & 1) > 0, (options & 1) > 0,
stream, stream,
cancellationToken); cancellationToken);
}
await NotifyUsersBySignalR(idWell, cancellationToken);
}
catch (FileFormatException ex) catch (FileFormatException ex)
{ {
return this.ValidationBadRequest(nameof(file), ex.Message); return this.ValidationBadRequest(nameof(file), ex.Message);
@ -195,14 +190,6 @@ public class WellDrillingProcessMapController : ProcessMapBaseController<WellDri
return File(template.File, "application/octet-stream", template.Name); return File(template.File, "application/octet-stream", template.Name);
} }
private async Task CheckIsExistsWellSectionTypeAsync(int idWellSectionType, CancellationToken cancellationToken)
{
var wellSection = await wellSectionRepository.GetOrDefaultAsync(idWellSectionType, cancellationToken);
if (wellSection is null)
throw new ArgumentInvalidException(nameof(WellDrillingProcessMapDto.IdWellSectionType), $"Тип секции с Id: {idWellSectionType} не найден");
}
private async Task NotifyUsersBySignalR(int idWell, CancellationToken cancellationToken) private async Task NotifyUsersBySignalR(int idWell, CancellationToken cancellationToken)
{ {
var wellDrillingProcessMaps = await repository.GetByIdWellAsync(idWell, cancellationToken); var wellDrillingProcessMaps = await repository.GetByIdWellAsync(idWell, cancellationToken);

View File

@ -0,0 +1,17 @@
using AsbCloudApp.Data;
using AsbCloudApp.Data.ProcessMaps;
using AsbCloudApp.Repositories;
using AsbCloudApp.Services;
namespace AsbCloudWebApi.Controllers.ProcessMaps;
public class ProcessMapWellReamController : ProcessMapBaseController<ProcessMapPlanWellReamDto>
{
public ProcessMapWellReamController(IWellService wellService,
IProcessMapPlanRepository<ProcessMapPlanWellReamDto> repository,
IUserRepository userRepository,
ICrudRepository<WellSectionTypeDto> wellSectionRepository)
: base(wellService, repository, userRepository, wellSectionRepository)
{
}
}

View File

@ -1,15 +0,0 @@
using AsbCloudApp.Data.ProcessMaps;
using AsbCloudApp.Repositories;
using AsbCloudApp.Services;
namespace AsbCloudWebApi.Controllers.ProcessMaps;
public class WellReamProcessMapController : ProcessMapBaseController<WellReamProcessMapDto>
{
public WellReamProcessMapController(IWellService wellService,
IWellReamProcessMapRepository repository,
IUserRepository userRepository)
: base(wellService, repository, userRepository)
{
}
}

View File

@ -1,13 +1,13 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks;
using System.Threading; using System.Threading;
using System.Threading.Tasks;
using AsbCloudApp.Data.ProcessMaps; using AsbCloudApp.Data.ProcessMaps;
using AsbCloudApp.Repositories; using AsbCloudApp.Repositories;
using AsbCloudApp.Requests; using AsbCloudApp.Requests;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Http;
using AsbCloudApp.Services; using AsbCloudApp.Services;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace AsbCloudWebApi.Controllers.SAUB; namespace AsbCloudWebApi.Controllers.SAUB;
@ -18,20 +18,17 @@ namespace AsbCloudWebApi.Controllers.SAUB;
[Route("api/[controller]")] [Route("api/[controller]")]
public class TelemetryProcessMapController : ControllerBase public class TelemetryProcessMapController : ControllerBase
{ {
private readonly IWellService wellService;
private readonly ITelemetryService telemetryService; private readonly ITelemetryService telemetryService;
private readonly IWellDrillingProcessMapRepository wellDrillingProcessMapRepository; private readonly IProcessMapPlanRepository<ProcessMapPlanWellDrillingDto> processMapPlanWellDrillingRepository;
private readonly IWellReamProcessMapRepository wellReamProcessMapRepository; private readonly IProcessMapPlanRepository<ProcessMapPlanWellReamDto> processMapPlanWellReamRepository;
public TelemetryProcessMapController(IWellService wellService, public TelemetryProcessMapController(ITelemetryService telemetryService,
ITelemetryService telemetryService, IProcessMapPlanRepository<ProcessMapPlanWellDrillingDto> processMapPlanWellDrillingRepository,
IWellDrillingProcessMapRepository wellDrillingProcessMapRepository, IProcessMapPlanRepository<ProcessMapPlanWellReamDto> processMapPlanWellReamRepository)
IWellReamProcessMapRepository wellReamProcessMapRepository)
{ {
this.wellService = wellService; this.telemetryService = telemetryService;
this.telemetryService = telemetryService; this.processMapPlanWellDrillingRepository = processMapPlanWellDrillingRepository;
this.wellDrillingProcessMapRepository = wellDrillingProcessMapRepository; this.processMapPlanWellReamRepository = processMapPlanWellReamRepository;
this.wellReamProcessMapRepository = wellReamProcessMapRepository;
} }
/// <summary> /// <summary>
@ -42,22 +39,22 @@ public class TelemetryProcessMapController : ControllerBase
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
[HttpGet("wellDrillingProcessMap")] [HttpGet("wellDrillingProcessMap")]
[ProducesResponseType(typeof(IEnumerable<WellDrillingProcessMapDto>), StatusCodes.Status200OK)] [ProducesResponseType(typeof(IEnumerable<ProcessMapPlanWellDrillingDto>), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)]
public async Task<IActionResult> GetWellDrillingProcessMapByUidAsync(string uid, DateTime updateFrom, CancellationToken cancellationToken) public async Task<IActionResult> GetWellDrillingProcessMapByUidAsync(string uid, DateTime updateFrom, CancellationToken cancellationToken)
{ {
var idWell = telemetryService.GetIdWellByTelemetryUid(uid); var idWell = telemetryService.GetIdWellByTelemetryUid(uid);
if (!idWell.HasValue)
return this.ValidationBadRequest(nameof(uid), $"Wrong uid {uid}");
var wellDrillingProcessMaps = await wellDrillingProcessMapRepository.GetAsync(new WellDrillingProcessMapRequest if (!idWell.HasValue)
{ return this.ValidationBadRequest(nameof(uid), $"Wrong uid {uid}");
IdWell = idWell.Value,
UpdateFrom = updateFrom
}, cancellationToken);
return Ok(wellDrillingProcessMaps); var wellDrillingProcessMaps = await processMapPlanWellDrillingRepository.GetAsync(new[] { new ProcessMapPlanRequest
{
IdWell = idWell.Value,
UpdateFrom = updateFrom
}}, cancellationToken);
return Ok(wellDrillingProcessMaps);
} }
/// <summary> /// <summary>
@ -68,23 +65,23 @@ public class TelemetryProcessMapController : ControllerBase
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
[HttpGet("wellReamProcessMap")] [HttpGet("wellReamProcessMap")]
[ProducesResponseType(typeof(IEnumerable<WellReamProcessMapDto>), StatusCodes.Status200OK)] [ProducesResponseType(typeof(IEnumerable<ProcessMapPlanWellReamDto>), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)]
public async Task<IActionResult> GetWellReamProcessMapByUidAsync(string uid, DateTime updateFrom, public async Task<IActionResult> GetWellReamProcessMapByUidAsync(string uid, DateTime updateFrom,
CancellationToken cancellationToken) CancellationToken cancellationToken)
{ {
var idWell = telemetryService.GetIdWellByTelemetryUid(uid); var idWell = telemetryService.GetIdWellByTelemetryUid(uid);
if (!idWell.HasValue) if (!idWell.HasValue)
return this.ValidationBadRequest(nameof(uid), $"Wrong uid {uid}"); return this.ValidationBadRequest(nameof(uid), $"Wrong uid {uid}");
var wellReamProcessMaps = await wellReamProcessMapRepository.GetAsync(new WellReamProcessMapRequest var wellReamProcessMaps = await processMapPlanWellReamRepository.GetAsync(new[] { new ProcessMapPlanRequest
{ {
IdWell = idWell.Value, IdWell = idWell.Value,
UpdateFrom = updateFrom UpdateFrom = updateFrom
}, cancellationToken); }}, cancellationToken);
return Ok(wellReamProcessMaps); return Ok(wellReamProcessMaps);
} }
} }