feat(api): оптимизация запросов на получение списка шаблонов, обновлен response
This commit is contained in:
@@ -18,9 +18,21 @@ namespace PARR.API.MappingProfiles
|
||||
#region Template
|
||||
|
||||
// --- Template ---
|
||||
CreateMap<Template, TemplateBaseResponse>()
|
||||
.Include<Template, TemplateResponse>()
|
||||
.Include<Template, TemplateListResponse>()
|
||||
.ForMember(d => d.Unit, o => o.MapFrom(s => s.Unit))
|
||||
.ForMember(d => d.StatusType, o => o.MapFrom(s => s.StatusType))
|
||||
.ForMember(d => d.Agent, o => o.MapFrom(s => s.Job!.Group!))
|
||||
.ForMember(d => d.SyncStatus, o => o.MapFrom(s => s.RobotConfigurations.OrderBy(t => t.RobotCode)))
|
||||
.ForMember(d => d.OrderCount, o => o.MapFrom(s => s.Orders.Count()))
|
||||
.ForMember(d => d.IsAutoDistributionEnabled, o => o.MapFrom(s => s.Job!.Group!.IsAutoDistributionEnabled));
|
||||
|
||||
CreateMap<Template, TemplateListResponse>();
|
||||
|
||||
CreateMap<Template, TemplateResponse>()
|
||||
.ForMember(d => d.Job, o => o.MapFrom(s => s.Job))
|
||||
.ForMember(d => d.Unit, o => o.MapFrom(s => s.Unit))
|
||||
//.ForMember(d => d.Unit, o => o.MapFrom(s => s.Unit))
|
||||
.ForMember(d => d.Process, o => o.MapFrom(s => s.Job!.Tnk!.Subprocess!.Process))
|
||||
.ForMember(d => d.Subprocess, o => o.MapFrom(s => s.Job!.Tnk!.Subprocess))
|
||||
.ForMember(d => d.Tnk, o => o.MapFrom(s => s.Job!.Tnk))
|
||||
@@ -31,16 +43,14 @@ namespace PARR.API.MappingProfiles
|
||||
.ForMember(d => d.Initiator, o => o.MapFrom<TemplateInitiatorResolver>())
|
||||
.ForMember(d => d.ClosingCode, o => o.MapFrom<TemplateClosingCodeResolver>())
|
||||
.ForMember(d => d.Category, o => o.MapFrom<TemplateCategoryResolver>())
|
||||
.ForMember(d => d.SyncStatus, o => o.MapFrom(s => s.RobotConfigurations.OrderBy(t => t.RobotCode)))
|
||||
//.ForMember(d => d.SyncStatus, o => o.MapFrom(s => s.RobotConfigurations.OrderBy(t => t.RobotCode)))
|
||||
.ForMember(d => d.Schedule, o => o.MapFrom<TemplateScheduleResolver>())
|
||||
.ForMember(d => d.Agent, o => o.MapFrom(s => s.Job!.Group!))
|
||||
//.ForMember(d => d.NextRun, o => o.MapFrom(s => s.ApplicationsInWork!.NextRun))
|
||||
//.ForMember(d => d.LastRun, o => o.MapFrom(s => s.ApplicationsInWork!.LastRun))
|
||||
.ForMember(d => d.NextRun, o => o.MapFrom(s => s.NextRun))
|
||||
.ForMember(d => d.LastRun, o => o.MapFrom(s => s.LastRun))
|
||||
.ForMember(d => d.OrderCount, o => o.MapFrom(s => s.Orders.Count()))
|
||||
.ForMember(d => d.IsAutoDistributionEnabled, o => o.MapFrom(s => s.Job!.Group!.IsAutoDistributionEnabled))
|
||||
.ForMember(d => d.StatusType, o => o.MapFrom(s => s.StatusType))
|
||||
//.ForMember(d => d.Agent, o => o.MapFrom(s => s.Job!.Group!))
|
||||
//.ForMember(d => d.NextRun, o => o.MapFrom(s => s.NextRun))
|
||||
//.ForMember(d => d.LastRun, o => o.MapFrom(s => s.LastRun))
|
||||
//.ForMember(d => d.OrderCount, o => o.MapFrom(s => s.Orders.Count()))
|
||||
//.ForMember(d => d.IsAutoDistributionEnabled, o => o.MapFrom(s => s.Job!.Group!.IsAutoDistributionEnabled))
|
||||
//.ForMember(d => d.StatusType, o => o.MapFrom(s => s.StatusType))
|
||||
.ForMember(d => d.ScheduleExcludeType, o => o.MapFrom(s => s.Job!.Group!.ScheduleExcludeType))
|
||||
.ForMember(d => d.ScheduleExcludeTypeCalendar, o => o.MapFrom(s => s.Job!.Group!.ScheduleExcludeTypeCalendar))
|
||||
.ForMember(d => d.DistributionConfig, o => o.MapFrom(s => s.Job.Group.DistributionConfig))
|
||||
|
||||
Reference in New Issue
Block a user