From 30765f618ba197292d943690f0c32d75e48beafd Mon Sep 17 00:00:00 2001 From: Mikhail Trubnikov Date: Fri, 26 Jan 2024 12:27:59 +1000 Subject: [PATCH] =?UTF-8?q?feat(api):=20=D0=B2=20=D1=80=D0=B5=D1=81=D0=BF?= =?UTF-8?q?=D0=BE=D0=BD=D1=81=20=D0=B8=D1=81=D1=82=D0=BE=D1=80=D0=B8=D0=B8?= =?UTF-8?q?=20=D1=80=D0=BE=D0=B1=D0=BE=D1=82=D0=B0,=20=D0=B4=D0=BE=D0=B1?= =?UTF-8?q?=D0=B0=D0=B2=D0=B8=D0=BB=20=D0=B8=D0=BD=D1=84=D1=83=20=D0=BE=20?= =?UTF-8?q?=D1=80=D0=BE=D0=B1=D0=BE=D1=82=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PARR.API/Contracts/V1/Responses/RobotHistoryResponse.cs | 2 ++ PARR.API/Controllers/V1/RobotHistoryController.cs | 4 ++++ PARR.API/MappingProfiles/DomainToResponseProfile.cs | 8 ++++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/PARR.API/Contracts/V1/Responses/RobotHistoryResponse.cs b/PARR.API/Contracts/V1/Responses/RobotHistoryResponse.cs index 8e5ec1b1..08371150 100644 --- a/PARR.API/Contracts/V1/Responses/RobotHistoryResponse.cs +++ b/PARR.API/Contracts/V1/Responses/RobotHistoryResponse.cs @@ -22,6 +22,8 @@ public string? TemplateName { get; set; } + public RobotResponse? Robot { get; set; } + } diff --git a/PARR.API/Controllers/V1/RobotHistoryController.cs b/PARR.API/Controllers/V1/RobotHistoryController.cs index 724992f2..e0f3a392 100644 --- a/PARR.API/Controllers/V1/RobotHistoryController.cs +++ b/PARR.API/Controllers/V1/RobotHistoryController.cs @@ -58,6 +58,8 @@ namespace PARR.API.Controllers.V1 IQueryable query = robotHistoryService.Get() .Include(t => t.RobotConfiguration) .ThenInclude(t => t!.Template) + .Include(t => t.RobotConfiguration) + .ThenInclude(t => t!.Robot) .Include(t => t.RobotHistoryLevel) .Include(t => t.StatusTask) .OrderByDescending(t => t.DateCreated); @@ -116,6 +118,8 @@ namespace PARR.API.Controllers.V1 var createdObj = await robotHistoryService.Get() .Include(t => t.RobotConfiguration) .ThenInclude(t => t!.Template) + .Include(t => t.RobotConfiguration) + .ThenInclude(t => t!.Robot) .Include(t => t.RobotHistoryLevel) .Include(t => t.StatusTask) .FirstOrDefaultAsync(t => t.Id == history.Id); diff --git a/PARR.API/MappingProfiles/DomainToResponseProfile.cs b/PARR.API/MappingProfiles/DomainToResponseProfile.cs index f170e8c6..016ded0b 100644 --- a/PARR.API/MappingProfiles/DomainToResponseProfile.cs +++ b/PARR.API/MappingProfiles/DomainToResponseProfile.cs @@ -74,7 +74,9 @@ namespace PARR.API.MappingProfiles .ForMember(d => d.Applications, o => o.MapFrom(s => s.ApplicationsInHosts.Select(t => t.Application).OrderBy(t => t.Name))); // === Host === - #endregion + #endregion + + #region Robot CreateMap(); @@ -86,8 +88,10 @@ namespace PARR.API.MappingProfiles .ForMember(d => d.TaskId, o => o.MapFrom(s => s.RobotConfigurationId)) .ForMember(d => d.TaskStatus, o => o.MapFrom(s => s.StatusTask)) .ForMember(d => d.TemplateId, o => o.MapFrom(s => s.RobotConfiguration!.TemplateId)) - .ForMember(d => d.TemplateName, o => o.MapFrom(s => s.RobotConfiguration!.Template!.Name)); + .ForMember(d => d.TemplateName, o => o.MapFrom(s => s.RobotConfiguration!.Template!.Name)) + .ForMember(d => d.Robot, o => o.MapFrom(s => s.RobotConfiguration!.Robot)); + #endregion #region RobotConfiguration // --- RobotConfiguration ---