From 9742f27a81fda1b8186243481446f308192c47ae Mon Sep 17 00:00:00 2001 From: Mikhail Kuznetsov Date: Wed, 24 Sep 2025 12:34:46 +1000 Subject: [PATCH] =?UTF-8?q?feat(api):=20=D0=98=D0=B7=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=B2=D0=B0=D0=BB=D0=B8=D0=B4=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D1=8F=20JobRequest,=20=D1=84=D0=B8=D0=BB=D1=8C=D1=82?= =?UTF-8?q?=D1=80=D1=8B=20=D0=B0=D1=82=D1=82=D1=80=D0=B8=D0=B1=D1=83=D1=82?= =?UTF-8?q?=D0=BE=D0=B2=20=D0=BC=D0=BE=D0=B3=D1=83=D1=82=20=D0=B1=D1=8B?= =?UTF-8?q?=D1=82=D1=8C=20=D0=BF=D1=83=D1=81=D1=82=D1=8B=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PARR.API/Controllers/V1/JobController.cs | 14 ++++---------- PARR.API/Validators/JobRequestValidator.cs | 19 ++++++++++--------- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/PARR.API/Controllers/V1/JobController.cs b/PARR.API/Controllers/V1/JobController.cs index 2e74961e..601ee61e 100644 --- a/PARR.API/Controllers/V1/JobController.cs +++ b/PARR.API/Controllers/V1/JobController.cs @@ -33,10 +33,7 @@ namespace PARR.API.Controllers.V1 private readonly IUriService uriService; private readonly IJobService jobService; private readonly ITemplateService templateService; - private readonly IJobGroupService jobGroupService; private readonly IValidator jobValidator; - private readonly IUnitFilterService unitFilterService; - private readonly IUnitService unitService; public JobController( ILogger logger, @@ -55,10 +52,7 @@ namespace PARR.API.Controllers.V1 this.uriService = uriService; this.jobService = jobService; this.templateService = templateService; - this.jobGroupService = jobGroupService; this.jobValidator = jobValidator; - this.unitFilterService = unitFilterService; - this.unitService = unitService; } /// @@ -88,10 +82,10 @@ namespace PARR.API.Controllers.V1 query = query .Include(t => t.UnitFilters) - .ThenInclude(t => t.FieldFilters.OrderBy(o => o.UnitField!.AihitName)) + .ThenInclude(t => t.FieldFilters) .ThenInclude(t => t.UnitField) .Include(t => t.UnitFilters) - .ThenInclude(t => t.RelationshipFilters.OrderBy(o => o.UnitField!.AihitName)) + .ThenInclude(t => t.RelationshipFilters) .ThenInclude(t => t.UnitField); } @@ -186,10 +180,10 @@ namespace PARR.API.Controllers.V1 .Include(t => t.Tnk) .Include(t => t.Group) .Include(t => t.UnitFilters) - .ThenInclude(t => t.FieldFilters.OrderBy(o => o.UnitField!.AihitName)) + .ThenInclude(t => t.FieldFilters) .ThenInclude(t => t.UnitField) .Include(t => t.UnitFilters) - .ThenInclude(t => t.RelationshipFilters.OrderBy(o => o.UnitField!.AihitName)) + .ThenInclude(t => t.RelationshipFilters) .FirstOrDefaultAsync(t => t.Id == job.Id); var locationUri = uriService.GetUri(ApiRoutes.Job.Get, ApiRoutes.Job.getParam, createdJob!.Id); diff --git a/PARR.API/Validators/JobRequestValidator.cs b/PARR.API/Validators/JobRequestValidator.cs index b8d3915d..e9c7d114 100644 --- a/PARR.API/Validators/JobRequestValidator.cs +++ b/PARR.API/Validators/JobRequestValidator.cs @@ -62,17 +62,18 @@ namespace PARR.API.Validators if (string.IsNullOrEmpty(unitFilter.UnitFilterMask)) return false; - if (unitFilter.FieldFilters == null || !unitFilter.FieldFilters.Any()) - return false; + //if (unitFilter.FieldFilters == null || !unitFilter.FieldFilters.Any()) + // return false; - foreach (var fieldFilter in unitFilter.FieldFilters) - { - var fieldId = fieldFilter.FieldId; - if (await unitFieldService.GetAsync(fieldId) == null) - return false; - } + if (unitFilter.FieldFilters != null && unitFilter.FieldFilters.Any()) + foreach (var fieldFilter in unitFilter.FieldFilters) + { + var fieldId = fieldFilter.FieldId; + if (await unitFieldService.GetAsync(fieldId) == null) + return false; + } - if (unitFilter.RelationshipFilters != null || unitFilter.FieldFilters.Any()) + if (unitFilter.RelationshipFilters != null && unitFilter.RelationshipFilters.Any()) foreach (var relationshipFilter in unitFilter.RelationshipFilters!) { var fieldId = relationshipFilter.FieldId;