fix(api): закомментированы методы удаления объектов управления трудозатратами. Могло привести к незапланированному удалению зависимых объектов

This commit is contained in:
Mikhail Kuznetsov
2024-03-06 16:06:07 +10:00
parent 39fd6bccda
commit 10661a88c6
4 changed files with 50 additions and 50 deletions

View File

@@ -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();
//}
}
}