fix(api): закомментированы методы удаления объектов управления трудозатратами. Могло привести к незапланированному удалению зависимых объектов
This commit is contained in:
@@ -2,19 +2,19 @@
|
||||
using FluentValidation;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PARR.API.Contracts.V1;
|
||||
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.Base;
|
||||
using PARR.API.Controllers.V1.Base;
|
||||
using PARR.API.Extensions;
|
||||
using PARR.API.Services.Interfaces;
|
||||
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.Models;
|
||||
using PARR.DAL.Services.Interfaces;
|
||||
|
||||
namespace PARR.API.Controllers.V1
|
||||
{
|
||||
@@ -182,20 +182,20 @@ namespace PARR.API.Controllers.V1
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete(ApiRoutes.Process.Delete)]
|
||||
public async Task<IActionResult> Delete([FromRoute] Guid id)
|
||||
{
|
||||
var process = await processService.GetAsync(id);
|
||||
//[HttpDelete(ApiRoutes.Process.Delete)]
|
||||
//public async Task<IActionResult> Delete([FromRoute] Guid id)
|
||||
//{
|
||||
// var process = await processService.GetAsync(id);
|
||||
|
||||
if (process == null)
|
||||
return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = $"Ошибка при удалении процесса. Не найден процесс Id: {id}" } }));
|
||||
// if (process == null)
|
||||
// return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = $"Ошибка при удалении процесса. Не найден процесс Id: {id}" } }));
|
||||
|
||||
if (!processService.Delete(process) || !await processService.CommitAsync())
|
||||
return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = $"Ошибка при удалении процесса из базы данных" } }));
|
||||
// if (!processService.Delete(process) || !await processService.CommitAsync())
|
||||
// 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>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete(ApiRoutes.Subprocess.Delete)]
|
||||
public async Task<IActionResult> Delete([FromRoute] Guid id)
|
||||
{
|
||||
var subprocess = await subprocessService.GetAsync(id);
|
||||
//[HttpDelete(ApiRoutes.Subprocess.Delete)]
|
||||
//public async Task<IActionResult> Delete([FromRoute] Guid id)
|
||||
//{
|
||||
// var subprocess = await subprocessService.GetAsync(id);
|
||||
|
||||
if (subprocess == null)
|
||||
return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = $"Ошибка при удалении подпроцесса. Не найден подпроцесс Id: {id}" } }));
|
||||
// if (subprocess == null)
|
||||
// return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = $"Ошибка при удалении подпроцесса. Не найден подпроцесс Id: {id}" } }));
|
||||
|
||||
if (!subprocessService.Delete(subprocess) || !await subprocessService.CommitAsync())
|
||||
return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = $"Ошибка при удалении подпроцесса из базы данных" } }));
|
||||
// if (!subprocessService.Delete(subprocess) || !await subprocessService.CommitAsync())
|
||||
// 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>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete(ApiRoutes.Tnk.Delete)]
|
||||
public async Task<IActionResult> Delete([FromRoute] Guid id)
|
||||
{
|
||||
var tnk = await tnkService.GetAsync(id);
|
||||
//[HttpDelete(ApiRoutes.Tnk.Delete)]
|
||||
//public async Task<IActionResult> Delete([FromRoute] Guid id)
|
||||
//{
|
||||
// var tnk = await tnkService.GetAsync(id);
|
||||
|
||||
if (tnk == null)
|
||||
return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = $"Ошибка при удалении ТНК. Не найдена ТНК Id: {id}" } }));
|
||||
// if (tnk == null)
|
||||
// return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = $"Ошибка при удалении ТНК. Не найдена ТНК Id: {id}" } }));
|
||||
|
||||
if (!tnkService.Delete(tnk) || !await tnkService.CommitAsync())
|
||||
return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = $"Ошибка при удалении ТНК из базы данных" } }));
|
||||
// if (!tnkService.Delete(tnk) || !await tnkService.CommitAsync())
|
||||
// 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>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete(ApiRoutes.Work.Delete)]
|
||||
public async Task<IActionResult> Delete([FromRoute] Guid id)
|
||||
{
|
||||
var work = await workService.GetAsync(id);
|
||||
//[HttpDelete(ApiRoutes.Work.Delete)]
|
||||
//public async Task<IActionResult> Delete([FromRoute] Guid id)
|
||||
//{
|
||||
// var work = await workService.GetAsync(id);
|
||||
|
||||
if (work == null)
|
||||
return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = $"Ошибка при удалении вида работ. Не найдена работа Id: {id}" } }));
|
||||
// if (work == null)
|
||||
// return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = $"Ошибка при удалении вида работ. Не найдена работа, Id: {id}" } }));
|
||||
|
||||
if (!workService.Delete(work) || !await workService.CommitAsync())
|
||||
return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = $"Ошибка при удалении вида работ." } }));
|
||||
// if (!workService.Delete(work) || !await workService.CommitAsync())
|
||||
// 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