Merge branch 'dev' of http://gitlab.dvgd.oao.rzd/devptk/parr/parr_api into dev
This commit is contained in:
@@ -47,6 +47,8 @@
|
|||||||
{
|
{
|
||||||
public const string GetMyIp = Base + "/tests/my-ip";
|
public const string GetMyIp = Base + "/tests/my-ip";
|
||||||
|
|
||||||
|
public const string GetNextRun = Base + "/tests/next-run";
|
||||||
|
|
||||||
public const string GetNextScheduleDate = Base + "/tests/next-schedule-date/" + paramApplicationInWorkId + "/" + paramDate;
|
public const string GetNextScheduleDate = Base + "/tests/next-schedule-date/" + paramApplicationInWorkId + "/" + paramDate;
|
||||||
|
|
||||||
public const string GetNextSchedule = Base + "/tests/next-schedule/" + paramApplicationInWorkId + "/" + paramDate;
|
public const string GetNextSchedule = Base + "/tests/next-schedule/" + paramApplicationInWorkId + "/" + paramDate;
|
||||||
|
|||||||
@@ -1,19 +1,13 @@
|
|||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
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.Queries;
|
|
||||||
using PARR.API.Contracts.V1.Responses;
|
|
||||||
using PARR.API.Contracts.V1.Responses.Base;
|
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.DAL.Cache.Services.Base;
|
using PARR.DAL.Cache.Services.Base;
|
||||||
using PARR.DAL.Contracts;
|
|
||||||
using PARR.DAL.DomainModels;
|
|
||||||
using PARR.DAL.DomainServices.UnitFilterService;
|
using PARR.DAL.DomainServices.UnitFilterService;
|
||||||
using PARR.DAL.Models.Job;
|
using PARR.DAL.NextRunServices;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
using PARR.DAL.Services.Interfaces.Job;
|
using PARR.DAL.Services.Interfaces.Job;
|
||||||
using PARR.DAL.Services.Interfaces.Unit;
|
using PARR.DAL.Services.Interfaces.Unit;
|
||||||
@@ -34,6 +28,8 @@ namespace PARR.API.Controllers.V1
|
|||||||
private readonly IJobUnitFilterService jobUnitFilterService;
|
private readonly IJobUnitFilterService jobUnitFilterService;
|
||||||
private readonly IUnitFilterService unitFilterService;
|
private readonly IUnitFilterService unitFilterService;
|
||||||
private readonly IMapper mapper;
|
private readonly IMapper mapper;
|
||||||
|
private readonly INextRunService nextRunService;
|
||||||
|
private readonly ITemplateService templateService;
|
||||||
|
|
||||||
public TestController(
|
public TestController(
|
||||||
IClientService clientService,
|
IClientService clientService,
|
||||||
@@ -45,7 +41,9 @@ namespace PARR.API.Controllers.V1
|
|||||||
IJobService jobService,
|
IJobService jobService,
|
||||||
IJobUnitFilterService jobUnitFilterService,
|
IJobUnitFilterService jobUnitFilterService,
|
||||||
IUnitFilterService unitFilterService,
|
IUnitFilterService unitFilterService,
|
||||||
IMapper mapper
|
IMapper mapper,
|
||||||
|
INextRunService nextRunService,
|
||||||
|
ITemplateService templateService
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.clientService = clientService;
|
this.clientService = clientService;
|
||||||
@@ -58,6 +56,8 @@ namespace PARR.API.Controllers.V1
|
|||||||
this.jobUnitFilterService = jobUnitFilterService;
|
this.jobUnitFilterService = jobUnitFilterService;
|
||||||
this.unitFilterService = unitFilterService;
|
this.unitFilterService = unitFilterService;
|
||||||
this.mapper = mapper;
|
this.mapper = mapper;
|
||||||
|
this.nextRunService = nextRunService;
|
||||||
|
this.templateService = templateService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -76,6 +76,22 @@ namespace PARR.API.Controllers.V1
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public record GetNextRunRequest(Guid TemplateId, bool IsNew);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Получить nextRun
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost(ApiRoutes.Test.GetNextRun)]
|
||||||
|
public async Task<IActionResult> GetNextRun([FromBody] GetNextRunRequest request)
|
||||||
|
{
|
||||||
|
var nextRun = await nextRunService.GetNextRunForTemplateAsync(request.TemplateId, request.IsNew);
|
||||||
|
var template = await templateService.GetAsync(request.TemplateId);
|
||||||
|
|
||||||
|
return Ok(new Response<object>(new { OldNextRun = template?.NextRun, NewNextRun = nextRun }, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///// <summary>
|
///// <summary>
|
||||||
///// Получить следующую дату запуска
|
///// Получить следующую дату запуска
|
||||||
///// </summary>
|
///// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user