feat(api): Отключена ручаня валидация в контроллере

This commit is contained in:
Mikhail Trubnikov
2026-05-19 16:52:33 +10:00
parent d8af0253b1
commit 8f61bbb73e
13 changed files with 102 additions and 99 deletions

View File

@@ -40,7 +40,7 @@ namespace PARR.API.Controllers.V1
private readonly IUriService uriService;
private readonly IJobRepository jobService;
private readonly ITemplateRepository templateService;
private readonly IValidator<JobRequest> jobValidator;
//private readonly IValidator<JobRequest> jobValidator;
private readonly IRabbitService mqService;
private readonly MqSettings mqSettings;
private readonly IClientService clientService;
@@ -54,7 +54,7 @@ namespace PARR.API.Controllers.V1
IJobRepository jobService,
ITemplateRepository templateService,
IJobGroupRepository jobGroupService,
IValidator<JobRequest> jobValidator,
//IValidator<JobRequest> jobValidator,
IUnitFilterService unitFilterService,
IUnitRepository unitService,
IRabbitService mqService,
@@ -69,7 +69,7 @@ namespace PARR.API.Controllers.V1
this.uriService = uriService;
this.jobService = jobService;
this.templateService = templateService;
this.jobValidator = jobValidator;
//this.jobValidator = jobValidator;
this.mqService = mqService;
this.mqSettings = mqSettings;
this.clientService = clientService;
@@ -188,12 +188,12 @@ namespace PARR.API.Controllers.V1
[HttpPost(ApiRoutes.Job.Create)]
public async Task<IActionResult> Create([FromBody] JobRequest request)
{
#region Валидация
var jobValidateResult = await jobValidator.ValidateAsync(request);//Валидация параметров самого задания
//#region Валидация
//var jobValidateResult = await jobValidator.ValidateAsync(request);//Валидация параметров самого задания
if (!jobValidateResult.IsValid)
return BadRequest(new Response(jobValidateResult.Errors));
#endregion
//if (!jobValidateResult.IsValid)
// return BadRequest(new Response(jobValidateResult.Errors));
//#endregion
//TODO: !!!!!!! проверить, если тип ЗОНТИК или ГРУППИРОВКА, то обязательно должны быть заполнены поля min max
@@ -262,9 +262,9 @@ namespace PARR.API.Controllers.V1
[HttpPut(ApiRoutes.Job.Update)]
public async Task<IActionResult> Update([FromRoute] Guid id, [FromBody] JobRequest request)
{
var resultValidate = await jobValidator.ValidateAsync(request);
if (!resultValidate.IsValid)
return BadRequest(new Response(resultValidate.Errors));
//var resultValidate = await jobValidator.ValidateAsync(request);
//if (!resultValidate.IsValid)
// return BadRequest(new Response(resultValidate.Errors));
var orig = await jobService.Get()
.Include(t => t.Tnk)