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

@@ -39,7 +39,7 @@ namespace PARR.API.Controllers.V1
private readonly IJobGroupRepository groupService;
private readonly IJobRepository jobService;
private readonly IEsppSchTypeConfigRepository esppConfigService;
private readonly IValidator<JobGroupRequest> validator;
//private readonly IValidator<JobGroupRequest> validator;
private readonly IJobGroupTypeRepository jobGroupTypeService;
private readonly IMatchingStatusService matchingStatusService;
private readonly IScheduleResponseAreaTimeOffsetRepository scheduleResponseAreaTimeOffsetService;
@@ -53,7 +53,7 @@ namespace PARR.API.Controllers.V1
IJobGroupRepository groupService,
IJobRepository jobService,
IEsppSchTypeConfigRepository esppConfigService,
IValidator<JobGroupRequest> validator,
//IValidator<JobGroupRequest> validator,
IJobGroupTypeRepository jobGroupTypeService,
IMatchingStatusService matchingStatusService,
IScheduleResponseAreaTimeOffsetRepository scheduleResponseAreaTimeOffsetService,
@@ -67,7 +67,7 @@ namespace PARR.API.Controllers.V1
this.groupService = groupService;
this.jobService = jobService;
this.esppConfigService = esppConfigService;
this.validator = validator;
//this.validator = validator;
this.jobGroupTypeService = jobGroupTypeService;
this.matchingStatusService = matchingStatusService;
this.scheduleResponseAreaTimeOffsetService = scheduleResponseAreaTimeOffsetService;
@@ -156,10 +156,10 @@ namespace PARR.API.Controllers.V1
[HttpPost(ApiRoutes.JobGroup.Create)]
public async Task<IActionResult> Create([FromBody] JobGroupRequest request)
{
var resultValidate = await validator.ValidateAsync(request);
//var resultValidate = await validator.ValidateAsync(request);
if (!resultValidate.IsValid)
return BadRequest(new Response(resultValidate.Errors));
//if (!resultValidate.IsValid)
// return BadRequest(new Response(resultValidate.Errors));
var jobGroup = new JobGroup
{
@@ -242,10 +242,10 @@ namespace PARR.API.Controllers.V1
[HttpPut(ApiRoutes.JobGroup.Update)]
public async Task<IActionResult> Update([FromRoute] Guid id, [FromBody] JobGroupRequest request)
{
var resultValidate = await validator.ValidateAsync(request);
//var resultValidate = await validator.ValidateAsync(request);
if (!resultValidate.IsValid)
return BadRequest(new Response(resultValidate.Errors));
//if (!resultValidate.IsValid)
// return BadRequest(new Response(resultValidate.Errors));
var orig = await groupService.Get()
.Include(t => t.Jobs)