fix(api): закомментированы методы удаления объектов управления трудозатратами. Могло привести к незапланированному удалению зависимых объектов
This commit is contained in:
@@ -2,19 +2,19 @@
|
|||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using PARR.API.Contracts.V1;
|
using PARR.API.Contracts.V1;
|
||||||
using PARR.API.Contracts.V1.Requests;
|
using PARR.API.Contracts.V1.Requests;
|
||||||
using PARR.API.Contracts.V1.Responses.Base;
|
using PARR.API.Contracts.V1.Requests.Queries;
|
||||||
using PARR.API.Contracts.V1.Responses;
|
using PARR.API.Contracts.V1.Responses;
|
||||||
|
using PARR.API.Contracts.V1.Responses.Base;
|
||||||
using PARR.API.Controllers.V1.Base;
|
using PARR.API.Controllers.V1.Base;
|
||||||
|
using PARR.API.Extensions;
|
||||||
using PARR.API.Services.Interfaces;
|
using PARR.API.Services.Interfaces;
|
||||||
using PARR.Constants;
|
using PARR.Constants;
|
||||||
using PARR.DAL.Services.Interfaces;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using PARR.DAL.Models;
|
|
||||||
using PARR.API.Contracts.V1.Requests.Queries;
|
|
||||||
using PARR.API.Extensions;
|
|
||||||
using PARR.DAL.DomainModels;
|
using PARR.DAL.DomainModels;
|
||||||
|
using PARR.DAL.Models;
|
||||||
|
using PARR.DAL.Services.Interfaces;
|
||||||
|
|
||||||
namespace PARR.API.Controllers.V1
|
namespace PARR.API.Controllers.V1
|
||||||
{
|
{
|
||||||
@@ -182,20 +182,20 @@ namespace PARR.API.Controllers.V1
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpDelete(ApiRoutes.Process.Delete)]
|
//[HttpDelete(ApiRoutes.Process.Delete)]
|
||||||
public async Task<IActionResult> Delete([FromRoute] Guid id)
|
//public async Task<IActionResult> Delete([FromRoute] Guid id)
|
||||||
{
|
//{
|
||||||
var process = await processService.GetAsync(id);
|
// var process = await processService.GetAsync(id);
|
||||||
|
|
||||||
if (process == null)
|
// if (process == null)
|
||||||
return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = $"Ошибка при удалении процесса. Не найден процесс Id: {id}" } }));
|
// return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = $"Ошибка при удалении процесса. Не найден процесс Id: {id}" } }));
|
||||||
|
|
||||||
if (!processService.Delete(process) || !await processService.CommitAsync())
|
// if (!processService.Delete(process) || !await processService.CommitAsync())
|
||||||
return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = $"Ошибка при удалении процесса из базы данных" } }));
|
// return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = $"Ошибка при удалении процесса из базы данных" } }));
|
||||||
|
|
||||||
logger.LogInformation($"Пользователь {User.Identity?.Name} удалил процесс: {process.Id}, {process.Name}, {process.EsppId}");
|
// logger.LogInformation($"Пользователь {User.Identity?.Name} удалил процесс: {process.Id}, {process.Name}, {process.EsppId}");
|
||||||
|
|
||||||
return NoContent();
|
// return NoContent();
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -184,20 +184,20 @@ namespace PARR.API.Controllers.V1
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpDelete(ApiRoutes.Subprocess.Delete)]
|
//[HttpDelete(ApiRoutes.Subprocess.Delete)]
|
||||||
public async Task<IActionResult> Delete([FromRoute] Guid id)
|
//public async Task<IActionResult> Delete([FromRoute] Guid id)
|
||||||
{
|
//{
|
||||||
var subprocess = await subprocessService.GetAsync(id);
|
// var subprocess = await subprocessService.GetAsync(id);
|
||||||
|
|
||||||
if (subprocess == null)
|
// if (subprocess == null)
|
||||||
return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = $"Ошибка при удалении подпроцесса. Не найден подпроцесс Id: {id}" } }));
|
// return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = $"Ошибка при удалении подпроцесса. Не найден подпроцесс Id: {id}" } }));
|
||||||
|
|
||||||
if (!subprocessService.Delete(subprocess) || !await subprocessService.CommitAsync())
|
// if (!subprocessService.Delete(subprocess) || !await subprocessService.CommitAsync())
|
||||||
return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = $"Ошибка при удалении подпроцесса из базы данных" } }));
|
// return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = $"Ошибка при удалении подпроцесса из базы данных" } }));
|
||||||
|
|
||||||
logger.LogInformation($"Пользователь {User.Identity?.Name} удалил подпроцесс: {subprocess.Id}, {subprocess.Name}, {subprocess.EsppId}, {subprocess.ProcessId}");
|
// logger.LogInformation($"Пользователь {User.Identity?.Name} удалил подпроцесс: {subprocess.Id}, {subprocess.Name}, {subprocess.EsppId}, {subprocess.ProcessId}");
|
||||||
|
|
||||||
return NoContent();
|
// return NoContent();
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -184,20 +184,20 @@ namespace PARR.API.Controllers.V1
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpDelete(ApiRoutes.Tnk.Delete)]
|
//[HttpDelete(ApiRoutes.Tnk.Delete)]
|
||||||
public async Task<IActionResult> Delete([FromRoute] Guid id)
|
//public async Task<IActionResult> Delete([FromRoute] Guid id)
|
||||||
{
|
//{
|
||||||
var tnk = await tnkService.GetAsync(id);
|
// var tnk = await tnkService.GetAsync(id);
|
||||||
|
|
||||||
if (tnk == null)
|
// if (tnk == null)
|
||||||
return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = $"Ошибка при удалении ТНК. Не найдена ТНК Id: {id}" } }));
|
// return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = $"Ошибка при удалении ТНК. Не найдена ТНК Id: {id}" } }));
|
||||||
|
|
||||||
if (!tnkService.Delete(tnk) || !await tnkService.CommitAsync())
|
// if (!tnkService.Delete(tnk) || !await tnkService.CommitAsync())
|
||||||
return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = $"Ошибка при удалении ТНК из базы данных" } }));
|
// return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = $"Ошибка при удалении ТНК из базы данных" } }));
|
||||||
|
|
||||||
logger.LogInformation($"Пользователь {User.Identity?.Name} удалил ТНК: {tnk.Id}, {tnk.Name}, {tnk.EsppId}, {tnk.SubprocessId}");
|
// logger.LogInformation($"Пользователь {User.Identity?.Name} удалил ТНК: {tnk.Id}, {tnk.Name}, {tnk.EsppId}, {tnk.SubprocessId}");
|
||||||
|
|
||||||
return NoContent();
|
// return NoContent();
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -163,21 +163,21 @@ namespace PARR.API.Controllers.V1
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpDelete(ApiRoutes.Work.Delete)]
|
//[HttpDelete(ApiRoutes.Work.Delete)]
|
||||||
public async Task<IActionResult> Delete([FromRoute] Guid id)
|
//public async Task<IActionResult> Delete([FromRoute] Guid id)
|
||||||
{
|
//{
|
||||||
var work = await workService.GetAsync(id);
|
// var work = await workService.GetAsync(id);
|
||||||
|
|
||||||
if (work == null)
|
// if (work == null)
|
||||||
return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = $"Ошибка при удалении вида работ. Не найдена работа Id: {id}" } }));
|
// return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = $"Ошибка при удалении вида работ. Не найдена работа, Id: {id}" } }));
|
||||||
|
|
||||||
if (!workService.Delete(work) || !await workService.CommitAsync())
|
// if (!workService.Delete(work) || !await workService.CommitAsync())
|
||||||
return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = $"Ошибка при удалении вида работ." } }));
|
// return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = $"Ошибка при удалении вида работ." } }));
|
||||||
|
|
||||||
logger.LogInformation($"Пользователь {User.Identity?.Name} удалил вид работ: {work.Id}, {work.Name}, {work.EsppId}, {work.TnkId}");
|
// logger.LogInformation($"Пользователь {User.Identity?.Name} удалил вид работ: {work.Id}, {work.Name}, {work.EsppId}, {work.TnkId}");
|
||||||
|
|
||||||
return NoContent();
|
// return NoContent();
|
||||||
}
|
//}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user