feat(api): в JobUnitPreview добавлена обработка ситуации NoContent
This commit is contained in:
@@ -12,6 +12,8 @@ using PARR.Constants;
|
|||||||
using PARR.DAL.DomainServices.Interfaces;
|
using PARR.DAL.DomainServices.Interfaces;
|
||||||
using PARR.DAL.Models.Job;
|
using PARR.DAL.Models.Job;
|
||||||
using PARR.DAL.Services.Interfaces.Unit;
|
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
|
namespace PARR.API.Controllers.V1
|
||||||
{
|
{
|
||||||
@@ -68,6 +70,9 @@ namespace PARR.API.Controllers.V1
|
|||||||
|
|
||||||
var units = await query.ToListAsync();
|
var units = await query.ToListAsync();
|
||||||
|
|
||||||
|
if (!units.Any())
|
||||||
|
return NoContent();
|
||||||
|
|
||||||
var unitResponse = mapper.Map<List<UnitBaseResponse>>(units);
|
var unitResponse = mapper.Map<List<UnitBaseResponse>>(units);
|
||||||
|
|
||||||
return Ok(new Response<List<UnitBaseResponse>>(unitResponse, true));
|
return Ok(new Response<List<UnitBaseResponse>>(unitResponse, true));
|
||||||
|
|||||||
@@ -317,8 +317,8 @@ namespace PARR.API.MappingProfiles
|
|||||||
|
|
||||||
CreateMap<JobUnitFilter, UnitFilterResponse>()
|
CreateMap<JobUnitFilter, UnitFilterResponse>()
|
||||||
.ForMember(d => d.UnitFilterMask, o => o.MapFrom(s => s.UnitFilter))
|
.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.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.RelationshipFilters, o => o.MapFrom(s => s.RelationshipFilters.OrderBy(o => o.UnitField!.AihitName)));
|
||||||
|
|
||||||
CreateMap<JobFieldFilter, FieldResponse>();
|
CreateMap<JobFieldFilter, FieldResponse>();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user