feat(api): HostController вывод даных из таблицы Unit

This commit is contained in:
Mikhail Kuznetsov
2025-06-06 16:39:41 +10:00
parent b82a1de8bf
commit 59b592fdd9
5 changed files with 112 additions and 22 deletions

View File

@@ -7,6 +7,7 @@ using PARR.Constants.Shortcodes;
using PARR.DAL.DomainModels;
using PARR.DAL.Extensions;
using PARR.DAL.Models;
using PARR.DAL.Models.Unit;
namespace PARR.API.MappingProfiles
{
@@ -103,6 +104,21 @@ namespace PARR.API.MappingProfiles
#endregion
#region Unit
CreateMap<UnitInValue, AttributeResponse>()
.ForMember(d => d.Id, o => o.MapFrom(s => s.Value!.Id))
.ForMember(d => d.Name, o => o.MapFrom(s => (string.IsNullOrEmpty(s.Field!.DisplayName)) ? s.Field!.AihitName : s.Field!.DisplayName))
.ForMember(d => d.Value, o => o.MapFrom(s => s.Value!.Value));
CreateMap<Unit, UnitResponse>()
.Include<Unit, UnitWithAttributesResponse>()
.ForMember(d => d.Name, o => o.MapFrom(s => s.Name));
CreateMap<Unit, UnitWithAttributesResponse>()
.ForMember(d => d.Attributes, o => o.MapFrom(s => s.UnitValues!.OrderBy(s => (string.IsNullOrEmpty(s.Field!.DisplayName)) ? s.Field!.AihitName : s.Field!.DisplayName)));
#endregion
#region WorkGroup
CreateMap<WorkGroup, WorkGroupResponse>();