feat(api): в JobUnitPreview добавлена обработка ситуации NoContent

This commit is contained in:
Mikhail Kuznetsov
2025-09-24 10:16:18 +10:00
parent 09f0f1e063
commit 6231f35236
2 changed files with 7 additions and 2 deletions

View File

@@ -12,6 +12,8 @@ using PARR.Constants;
using PARR.DAL.DomainServices.Interfaces;
using PARR.DAL.Models.Job;
using PARR.DAL.Services.Interfaces.Unit;
using static PARR.API.Contracts.V1.ApiRoutes;
using Job = PARR.DAL.Models.Job.Job;
namespace PARR.API.Controllers.V1
{
@@ -68,6 +70,9 @@ namespace PARR.API.Controllers.V1
var units = await query.ToListAsync();
if (!units.Any())
return NoContent();
var unitResponse = mapper.Map<List<UnitBaseResponse>>(units);
return Ok(new Response<List<UnitBaseResponse>>(unitResponse, true));

View File

@@ -317,8 +317,8 @@ namespace PARR.API.MappingProfiles
CreateMap<JobUnitFilter, UnitFilterResponse>()
.ForMember(d => d.UnitFilterMask, o => o.MapFrom(s => s.UnitFilter))
.ForMember(d => d.FieldFilters, o => o.MapFrom(s => s.FieldFilters.OrderBy(o => o.UnitField.AihitName)))
.ForMember(d => d.RelationshipFilters, o => o.MapFrom(s => s.RelationshipFilters.OrderBy(o => o.UnitField.AihitName)));
.ForMember(d => d.FieldFilters, o => o.MapFrom(s => s.FieldFilters.OrderBy(o => o.UnitField!.AihitName)))
.ForMember(d => d.RelationshipFilters, o => o.MapFrom(s => s.RelationshipFilters.OrderBy(o => o.UnitField!.AihitName)));
CreateMap<JobFieldFilter, FieldResponse>();