forked from ddrilling/AsbCloudServer
Рефакторинг изменений
Добавленный метод удаления в предыдущем коммите, являлся избыточным.
This commit is contained in:
parent
b58cd2d636
commit
1d2b81b724
@ -17,14 +17,5 @@ namespace AsbCloudApp.Services
|
|||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IEnumerable<ProcessMapReportDto>> GetProcessMapReportAsync(int idWell, CancellationToken token);
|
Task<IEnumerable<ProcessMapReportDto>> GetProcessMapReportAsync(int idWell, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Удаление записи РТК
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id"></param>
|
|
||||||
/// <param name="idWell"></param>
|
|
||||||
/// <param name="token"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<int> DeleteAsync(int id, int idWell, CancellationToken token);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,16 +54,6 @@ namespace AsbCloudInfrastructure.Services.ProcessMap
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> DeleteAsync(int id, int idWell, CancellationToken token)
|
|
||||||
{
|
|
||||||
var processMap = await processMapPlanRepository.GetOrDefaultAsync(id, token);
|
|
||||||
|
|
||||||
if (processMap?.IdWell != idWell)
|
|
||||||
throw new ArgumentInvalidException("Запись РТК принадлежит другой скважине", nameof(idWell));
|
|
||||||
|
|
||||||
return await processMapPlanRepository.DeleteAsync(id, token);
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerable<ProcessMapReportDto> CalcByIntervals(IEnumerable<ProcessMapPlanDto> processMapPlan, TelemetryDataSaubStatDto[] telemetryDataStat)
|
private IEnumerable<ProcessMapReportDto> CalcByIntervals(IEnumerable<ProcessMapPlanDto> processMapPlan, TelemetryDataSaubStatDto[] telemetryDataStat)
|
||||||
{
|
{
|
||||||
var processMapIntervals = CalcDepthIntervals(processMapPlan);
|
var processMapIntervals = CalcDepthIntervals(processMapPlan);
|
||||||
|
@ -251,16 +251,6 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
return File(stream, "application/octet-stream", fileName);
|
return File(stream, "application/octet-stream", fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpDelete("{id}/{idWell}")]
|
|
||||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
|
||||||
public async Task<ActionResult<int>> DeleteAsync(int id, int idWell, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
if (!await CanUserEditProcessMapAsync(idWell, cancellationToken))
|
|
||||||
return Forbid();
|
|
||||||
|
|
||||||
return await processMapService.DeleteAsync(id, idWell, cancellationToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task<bool> CanUserEditProcessMapAsync(int idWell, CancellationToken token)
|
private async Task<bool> CanUserEditProcessMapAsync(int idWell, CancellationToken token)
|
||||||
{
|
{
|
||||||
var idUser = User.GetUserId();
|
var idUser = User.GetUserId();
|
||||||
|
Loading…
Reference in New Issue
Block a user