fix(API,DAL): Восстановлена работа контроллеров RobotTask, TemplateActivator, Template
This commit is contained in:
@@ -11,7 +11,7 @@ using PARR.BLL.Domain.Mq;
|
||||
using PARR.BLL.Services.Interfaces;
|
||||
using PARR.Common.Domain;
|
||||
using PARR.Constants;
|
||||
using PARR.DAL.Services.Interfaces;
|
||||
using PARR.DAL.Services.Interfaces.Job;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace PARR.API.Controllers.V1
|
||||
@@ -26,7 +26,7 @@ namespace PARR.API.Controllers.V1
|
||||
private readonly IMqService mqService;
|
||||
private readonly IUriService uriService;
|
||||
private readonly MqSettings mqSettings;
|
||||
private readonly IApplicationsInWorkService applicationsInWorkService;
|
||||
private readonly IJobService jobService;
|
||||
private readonly IClientService clientService;
|
||||
|
||||
public TemplateActivatorController(
|
||||
@@ -34,7 +34,7 @@ namespace PARR.API.Controllers.V1
|
||||
IMqService mqService,
|
||||
IUriService uriService,
|
||||
MqSettings mqSettings,
|
||||
IApplicationsInWorkService applicationsInWorkService,
|
||||
IJobService jobService,
|
||||
IClientService clientService
|
||||
)
|
||||
{
|
||||
@@ -42,7 +42,7 @@ namespace PARR.API.Controllers.V1
|
||||
this.mqService = mqService;
|
||||
this.uriService = uriService;
|
||||
this.mqSettings = mqSettings;
|
||||
this.applicationsInWorkService = applicationsInWorkService;
|
||||
this.jobService = jobService;
|
||||
this.clientService = clientService;
|
||||
}
|
||||
|
||||
@@ -50,24 +50,24 @@ namespace PARR.API.Controllers.V1
|
||||
/// <summary>
|
||||
/// Отправить запрос на активацию/деактивацию шаблонов/расписаний
|
||||
/// </summary>
|
||||
/// <param name="applicationInWorkId"></param>
|
||||
/// <param name="jobId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost(ApiRoutes.TemplateActivator.SendRequest)]
|
||||
public async Task<IActionResult> SendRequest([FromRoute] Guid applicationInWorkId, [FromBody] TemplateActivatorRequest request)
|
||||
public async Task<IActionResult> SendRequest([FromRoute] Guid jobId, [FromBody] TemplateActivatorRequest request)
|
||||
{
|
||||
var resultValidate = await validator.ValidateAsync(request);
|
||||
if (!resultValidate.IsValid)
|
||||
return BadRequest(new Response(resultValidate.Errors));
|
||||
|
||||
var appInWork = await applicationsInWorkService.GetAsync(applicationInWorkId);
|
||||
var job = await jobService.GetAsync(jobId);
|
||||
|
||||
if (appInWork == null)
|
||||
return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { FieldName = nameof(applicationInWorkId), Message = "Некорректное значение" } }));
|
||||
if (job == null)
|
||||
return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { FieldName = nameof(jobId), Message = "Некорректное значение" } }));
|
||||
|
||||
|
||||
var mqRequest = new TemplateActivatorMq
|
||||
{
|
||||
ApplicationInWorkId = applicationInWorkId,
|
||||
JobId = jobId,
|
||||
Action = request.Action,
|
||||
HistoryInitiator = new HistoryInitiator { InitiatorIp = clientService.GetClientIp()?.ToString(), InitiatorParrComponentId = ParrComponentsEnum.Api }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user