From b3879062a6ec2629fca05c7623995298cd9d7662 Mon Sep 17 00:00:00 2001 From: Mikhail Trubnikov Date: Thu, 23 Jul 2026 14:39:55 +1000 Subject: [PATCH] =?UTF-8?q?feat(api,core,domain):=20=D0=98=D0=B7=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=B5=D0=BD=20=D0=BA=D0=BE=D0=BD=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=BB=D0=BB=D0=B5=D1=80=20RobotTaskRobotStatusController,=20?= =?UTF-8?q?=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=81=D1=82=D0=B0=D1=82=D1=83=D1=81?= =?UTF-8?q?=D0=B0=20=D0=B7=D0=B0=D0=B4=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=B2?= =?UTF-8?q?=D1=8B=D0=BD=D0=B5=D1=81=D0=B5=D0=BD=20=D0=B2=20=D1=81=D0=B5?= =?UTF-8?q?=D1=80=D0=B2=D0=B8=D1=81=D1=8B.=20=D0=94=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B0=20=D0=BB=D0=BE=D0=B3=D0=B8=D0=BA?= =?UTF-8?q?=D0=B0=20=D1=83=D1=81=D0=BF=D1=80=D0=B5=D1=88=D0=BD=D0=BE=D0=B3?= =?UTF-8?q?=D0=BE=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B8=D0=BC=D0=B5=D0=BD=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20=D1=88=D0=B0=D0=B1=D0=BB=D0=BE?= =?UTF-8?q?=D0=BD=D0=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../V1/RobotTaskRobotStatusController.cs | 103 +++++++++--------- .../DomainToResponseProfile.cs | 17 ++- PARR.Core/DependencyInjection.cs | 3 + .../RobotConfigurationResultMappingProfile.cs | 17 +++ .../Mapping/Shared/RobotDtoMappingProfile.cs | 14 +++ .../Shared/RobotStatusDtoMappingProfile.cs | 14 +++ .../RobotTaskStatusDtoMappingProfile.cs | 13 +++ .../ITemplateRenamePendingRepository.cs | 1 + .../Implementations/RobotTaskService.cs | 2 - .../RobotTaskRobotStatusService.cs | 98 +++++++++++++++++ .../IRobotTaskRobotStatusService.cs | 17 +++ .../TemplateRenamePendingRepository.cs | 6 + .../RobotTaskRobotStatus/ChangeRobotStatus.cs | 13 +++ .../RobotConfigurationResult.cs | 23 ++++ PARR.Domain/DTOs/Shared/RobotDto.cs | 9 ++ PARR.Domain/DTOs/Shared/RobotStatusDto.cs | 9 ++ PARR.Domain/DTOs/Shared/RobotTaskStatusDto.cs | 9 ++ 17 files changed, 313 insertions(+), 55 deletions(-) create mode 100644 PARR.Core/Infrastructure/Mapping/RobotTaskRobotStatus/RobotConfigurationResultMappingProfile.cs create mode 100644 PARR.Core/Infrastructure/Mapping/Shared/RobotDtoMappingProfile.cs create mode 100644 PARR.Core/Infrastructure/Mapping/Shared/RobotStatusDtoMappingProfile.cs create mode 100644 PARR.Core/Infrastructure/Mapping/Shared/RobotTaskStatusDtoMappingProfile.cs create mode 100644 PARR.Core/Services/RobotTaskRobotStatus/Implemetations/RobotTaskRobotStatusService.cs create mode 100644 PARR.Core/Services/RobotTaskRobotStatus/Interfaces/IRobotTaskRobotStatusService.cs create mode 100644 PARR.Domain/DTOs/RobotTaskRobotStatus/ChangeRobotStatus.cs create mode 100644 PARR.Domain/DTOs/RobotTaskRobotStatus/RobotConfigurationResult.cs create mode 100644 PARR.Domain/DTOs/Shared/RobotDto.cs create mode 100644 PARR.Domain/DTOs/Shared/RobotStatusDto.cs create mode 100644 PARR.Domain/DTOs/Shared/RobotTaskStatusDto.cs diff --git a/PARR.API/Controllers/V1/RobotTaskRobotStatusController.cs b/PARR.API/Controllers/V1/RobotTaskRobotStatusController.cs index 91918a33..d2c2aa58 100644 --- a/PARR.API/Controllers/V1/RobotTaskRobotStatusController.cs +++ b/PARR.API/Controllers/V1/RobotTaskRobotStatusController.cs @@ -1,40 +1,34 @@ using AutoMapper; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; using PARR.API.Contracts.V1; using PARR.API.Contracts.V1.Requests; using PARR.API.Contracts.V1.Responses; using PARR.API.Contracts.V1.Responses.Base; using PARR.API.Controllers.V1.Base; using PARR.API.Services.Interfaces; -using PARR.Core.Repositories.Interfaces; +using PARR.Core.Services.RobotTaskRobotStatus.Interfaces; using PARR.Domain.Common.Roles; -using PARR.Domain.Entities; -using PARR.Domain.Entities.RobotEntities; -using PARR.Domain.Enums; +using PARR.Domain.DTOs.RobotTaskRobotStatus; namespace PARR.API.Controllers.V1 { [Authorize(Roles = ParrRoles.EsppRobot.RoleOrAdmin)] public class RobotTaskRobotStatusController : BaseApiController { - private readonly IRobotConfigurationRepository robotConfigurationService; - private readonly IRobotHistoryRepository robotHistoryService; - private readonly IMapper mapper; - private readonly IClientService clientService; + private readonly IMapper _mapper; + private readonly IClientService _clientService; + private readonly IRobotTaskRobotStatusService _robotTaskRobotStatusService; public RobotTaskRobotStatusController( - IRobotConfigurationRepository robotConfigurationService, - IRobotHistoryRepository robotHistoryService, IMapper mapper, - IClientService clientService + IClientService clientService, + IRobotTaskRobotStatusService robotTaskRobotStatusService ) { - this.robotConfigurationService = robotConfigurationService; - this.robotHistoryService = robotHistoryService; - this.mapper = mapper; - this.clientService = clientService; + _mapper = mapper; + _clientService = clientService; + _robotTaskRobotStatusService = robotTaskRobotStatusService; } @@ -46,47 +40,58 @@ namespace PARR.API.Controllers.V1 [HttpPut(ApiRoutes.RobotTaskRobotStatus.ChangeRobotStatus)] public async Task ChangeStatus([FromRoute] Guid taskId, [FromBody] RobotTaskChangeRobotStatusRequest request) { - var config = await robotConfigurationService.Get() - .FirstOrDefaultAsync(t => t.Id == taskId); + #region Old - if (config == null) - return BadRequest(new Response(false, new List { new ErrorModel { Message = $"Не найдено задание с id: {taskId}" } })); + //var config = await _robotConfigurationRepository.Get() + // .FirstOrDefaultAsync(t => t.Id == taskId); - //изменение статуса робота - robotConfigurationService.ChangeRobotStatus(request.RobotStatusCode, config); + //if (config == null) + // return BadRequest(new Response(false, new List { new ErrorModel { Message = $"Не найдено задание с id: {taskId}" } })); - //если успех, изменяем статус задания на успех - if (request.RobotStatusCode == RobotStatusEnum.Complete) - robotConfigurationService.ChangeTaskStatus(TaskStatusEnum.Ok, config); + ////изменение статуса робота + //_robotConfigurationRepository.ChangeRobotStatus(request.RobotStatusCode, config); - if (!await robotConfigurationService.CommitAsync()) - return BadRequest("Ошибка при изменении статуса работы робота."); + ////если успех, изменяем статус задания на успех + //if (request.RobotStatusCode == RobotStatusEnum.Complete) + // _robotConfigurationRepository.ChangeTaskStatus(TaskStatusEnum.Ok, config); - //записываем в лог робота - if (request.RobotStatusCode == RobotStatusEnum.InProgress || request.RobotStatusCode == RobotStatusEnum.Complete) - { - var historyLevel = request.RobotStatusCode == RobotStatusEnum.InProgress ? RobotHistoryLevelEnum.Start : RobotHistoryLevelEnum.Complete; + //if (!await _robotConfigurationRepository.CommitAsync()) + // return BadRequest("Ошибка при изменении статуса работы робота."); - var history = new RobotHistory - { - Id = Guid.NewGuid(), - HistoryLevel = (int)historyLevel, - TaskStatusCode = config.TaskStatusCode, - RobotConfigurationId = config.Id, - RobotIp = clientService.GetClientIp()?.ToString(), - RobotId = request.RobotId - }; - await robotHistoryService.CreateAsync(history); - await robotHistoryService.CommitAsync(); - } + ////записываем в лог робота + //if (request.RobotStatusCode == RobotStatusEnum.InProgress || request.RobotStatusCode == RobotStatusEnum.Complete) + //{ + // var historyLevel = request.RobotStatusCode == RobotStatusEnum.InProgress ? RobotHistoryLevelEnum.Start : RobotHistoryLevelEnum.Complete; - var configToResponse = await robotConfigurationService.Get() - .Include(t => t.Robot) - .Include(t => t.TaskStatus) - .Include(t => t.RobotStatus) - .FirstOrDefaultAsync(t => t.Id == taskId); + // var history = new RobotHistory + // { + // Id = Guid.NewGuid(), + // HistoryLevel = (int)historyLevel, + // TaskStatusCode = config.TaskStatusCode, + // RobotConfigurationId = config.Id, + // RobotIp = _clientService.GetClientIp()?.ToString(), + // RobotId = request.RobotId + // }; + // await _robotHistoryRepository.CreateAsync(history); + // await _robotHistoryRepository.CommitAsync(); + //} - var response = mapper.Map(configToResponse); + //var configToResponse = await _robotConfigurationRepository.Get() + // .Include(t => t.Robot) + // .Include(t => t.TaskStatus) + // .Include(t => t.RobotStatus) + // .FirstOrDefaultAsync(t => t.Id == taskId); + + //var response = _mapper.Map(configToResponse); + + //return Ok(new Response(response, true)); + + #endregion + + var changeRequest = new ChangeRobotStatus(taskId, request.RobotStatusCode, request.RobotId, _clientService.GetClientIp()?.ToString()); + var result = await _robotTaskRobotStatusService.ChangeStatusAsync(changeRequest); + + var response = _mapper.Map(result); return Ok(new Response(response, true)); } diff --git a/PARR.API/MappingProfiles/DomainToResponseProfile.cs b/PARR.API/MappingProfiles/DomainToResponseProfile.cs index 82b1d151..bbbd2ea7 100644 --- a/PARR.API/MappingProfiles/DomainToResponseProfile.cs +++ b/PARR.API/MappingProfiles/DomainToResponseProfile.cs @@ -8,6 +8,8 @@ using PARR.Domain.DTOs.Matching; using PARR.Domain.DTOs.RobotMetrics; using PARR.Domain.DTOs.RobotSnapshotDTO; using PARR.Domain.DTOs.RobotTask; +using PARR.Domain.DTOs.RobotTaskRobotStatus; +using PARR.Domain.DTOs.Shared; using PARR.Domain.DTOs.Shortcode; using PARR.Domain.DTOs.TaskDTO; using PARR.Domain.DTOs.User; @@ -258,10 +260,17 @@ namespace PARR.API.MappingProfiles CreateMap(); - CreateMap() - .ForMember(d => d.Robot, o => o.MapFrom(s => s.Robot)) - .ForMember(d => d.TaskStatus, o => o.MapFrom(s => s.TaskStatus)) - .ForMember(d => d.RobotStatus, o => o.MapFrom(s => s.RobotStatus)); + //CreateMap() + // .ForMember(d => d.Robot, o => o.MapFrom(s => s.Robot)) + // .ForMember(d => d.TaskStatus, o => o.MapFrom(s => s.TaskStatus)) + // .ForMember(d => d.RobotStatus, o => o.MapFrom(s => s.RobotStatus)); + + CreateMap(); + CreateMap(); + CreateMap(); + + CreateMap(); + // === RobotConfiguration === #endregion diff --git a/PARR.Core/DependencyInjection.cs b/PARR.Core/DependencyInjection.cs index c1d29715..e611a188 100644 --- a/PARR.Core/DependencyInjection.cs +++ b/PARR.Core/DependencyInjection.cs @@ -12,6 +12,8 @@ using PARR.Core.Services.RobotMetrics; using PARR.Core.Services.RobotSnapshotServices; using PARR.Core.Services.RobotTask.Implementations; using PARR.Core.Services.RobotTask.Interfaces; +using PARR.Core.Services.RobotTaskRobotStatus.Implemetations; +using PARR.Core.Services.RobotTaskRobotStatus.Interfaces; using PARR.Core.Services.Shortcodes; using PARR.Core.Services.Shortcodes.Handlers; using PARR.Core.Services.Snapshots.Implementations; @@ -111,6 +113,7 @@ namespace PARR.Core services.AddScoped(); services.AddScoped(); + services.AddScoped(); services.AddScoped(); services.AddScoped(); diff --git a/PARR.Core/Infrastructure/Mapping/RobotTaskRobotStatus/RobotConfigurationResultMappingProfile.cs b/PARR.Core/Infrastructure/Mapping/RobotTaskRobotStatus/RobotConfigurationResultMappingProfile.cs new file mode 100644 index 00000000..6b7bae01 --- /dev/null +++ b/PARR.Core/Infrastructure/Mapping/RobotTaskRobotStatus/RobotConfigurationResultMappingProfile.cs @@ -0,0 +1,17 @@ +using AutoMapper; +using PARR.Domain.DTOs.RobotTaskRobotStatus; +using PARR.Domain.Entities; + +namespace PARR.Core.Infrastructure.Mapping.RobotTaskRobotStatus +{ + internal class RobotConfigurationResultMappingProfile : Profile + { + public RobotConfigurationResultMappingProfile() + { + CreateMap() + .ForMember(d => d.Robot, o => o.MapFrom(s => s.Robot)) + .ForMember(d => d.TaskStatus, o => o.MapFrom(s => s.TaskStatus)) + .ForMember(d => d.RobotStatus, o => o.MapFrom(s => s.RobotStatus)); + } + } +} diff --git a/PARR.Core/Infrastructure/Mapping/Shared/RobotDtoMappingProfile.cs b/PARR.Core/Infrastructure/Mapping/Shared/RobotDtoMappingProfile.cs new file mode 100644 index 00000000..a52685d8 --- /dev/null +++ b/PARR.Core/Infrastructure/Mapping/Shared/RobotDtoMappingProfile.cs @@ -0,0 +1,14 @@ +using AutoMapper; +using PARR.Domain.DTOs.Shared; +using PARR.Domain.Entities.RobotEntities; + +namespace PARR.Core.Infrastructure.Mapping.Shared +{ + public class RobotDtoMappingProfile : Profile + { + public RobotDtoMappingProfile() + { + CreateMap(); + } + } +} diff --git a/PARR.Core/Infrastructure/Mapping/Shared/RobotStatusDtoMappingProfile.cs b/PARR.Core/Infrastructure/Mapping/Shared/RobotStatusDtoMappingProfile.cs new file mode 100644 index 00000000..a6112b4c --- /dev/null +++ b/PARR.Core/Infrastructure/Mapping/Shared/RobotStatusDtoMappingProfile.cs @@ -0,0 +1,14 @@ +using AutoMapper; +using PARR.Domain.DTOs.Shared; +using PARR.Domain.Entities.RobotEntities; + +namespace PARR.Core.Infrastructure.Mapping.Shared +{ + public class RobotStatusDtoMappingProfile : Profile + { + public RobotStatusDtoMappingProfile() + { + CreateMap(); + } + } +} diff --git a/PARR.Core/Infrastructure/Mapping/Shared/RobotTaskStatusDtoMappingProfile.cs b/PARR.Core/Infrastructure/Mapping/Shared/RobotTaskStatusDtoMappingProfile.cs new file mode 100644 index 00000000..0f002bdf --- /dev/null +++ b/PARR.Core/Infrastructure/Mapping/Shared/RobotTaskStatusDtoMappingProfile.cs @@ -0,0 +1,13 @@ +using AutoMapper; +using PARR.Domain.DTOs.Shared; + +namespace PARR.Core.Infrastructure.Mapping.Shared +{ + public class RobotTaskStatusDtoMappingProfile : Profile + { + public RobotTaskStatusDtoMappingProfile() + { + CreateMap(); + } + } +} diff --git a/PARR.Core/Repositories/Interfaces/TemplateRepositories/ITemplateRenamePendingRepository.cs b/PARR.Core/Repositories/Interfaces/TemplateRepositories/ITemplateRenamePendingRepository.cs index 9e892852..9df16628 100644 --- a/PARR.Core/Repositories/Interfaces/TemplateRepositories/ITemplateRenamePendingRepository.cs +++ b/PARR.Core/Repositories/Interfaces/TemplateRepositories/ITemplateRenamePendingRepository.cs @@ -6,5 +6,6 @@ namespace PARR.Core.Repositories.Interfaces.TemplateRepositories { Task CreateAsync(TemplateRenamePending obj); IQueryable Get(); + void Remove(TemplateRenamePending obj); } } diff --git a/PARR.Core/Services/RobotTask/Implementations/RobotTaskService.cs b/PARR.Core/Services/RobotTask/Implementations/RobotTaskService.cs index e44c506a..0ff18d5b 100644 --- a/PARR.Core/Services/RobotTask/Implementations/RobotTaskService.cs +++ b/PARR.Core/Services/RobotTask/Implementations/RobotTaskService.cs @@ -1,5 +1,4 @@ using AutoMapper; -using InfluxDB.Client.Api.Domain; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using PARR.BLL.Helpers; @@ -9,7 +8,6 @@ using PARR.Core.Services.NextRunServices; using PARR.Core.Services.RobotTask.Interfaces; using PARR.Core.Services.RobotTask.Models; using PARR.Core.Services.Shortcodes; -using PARR.Domain.Common.Template; using PARR.Domain.DTOs.RobotTask; using PARR.Domain.Entities; using PARR.Domain.Entities.Base.History; diff --git a/PARR.Core/Services/RobotTaskRobotStatus/Implemetations/RobotTaskRobotStatusService.cs b/PARR.Core/Services/RobotTaskRobotStatus/Implemetations/RobotTaskRobotStatusService.cs new file mode 100644 index 00000000..2e7ac095 --- /dev/null +++ b/PARR.Core/Services/RobotTaskRobotStatus/Implemetations/RobotTaskRobotStatusService.cs @@ -0,0 +1,98 @@ +using AutoMapper; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; +using PARR.Core.Repositories.Interfaces; +using PARR.Core.Repositories.Interfaces.TemplateRepositories; +using PARR.Core.Services.RobotTaskRobotStatus.Interfaces; +using PARR.Domain.DTOs.RobotTaskRobotStatus; +using PARR.Domain.Entities.RobotEntities; +using PARR.Domain.Enums; +using PARR.Domain.Exceptions; + +namespace PARR.Core.Services.RobotTaskRobotStatus.Implemetations +{ + internal class RobotTaskRobotStatusService : IRobotTaskRobotStatusService + { + private readonly ILogger _logger; + private readonly IRobotConfigurationRepository _robotConfigurationRepository; + private readonly IRobotHistoryRepository _robotHistoryRepository; + private readonly ITemplateRenamePendingRepository _templateRenamePendingRepository; + private readonly IMapper _mapper; + + public RobotTaskRobotStatusService( + ILogger logger, + IRobotConfigurationRepository robotConfigurationRepository, + IRobotHistoryRepository robotHistoryRepository, + ITemplateRenamePendingRepository templateRenamePendingRepository, + IMapper mapper + ) + { + _logger = logger; + _robotConfigurationRepository = robotConfigurationRepository; + _robotHistoryRepository = robotHistoryRepository; + _templateRenamePendingRepository = templateRenamePendingRepository; + _mapper = mapper; + } + + + public async Task ChangeStatusAsync(ChangeRobotStatus request) + { + var config = await _robotConfigurationRepository.Get() + .FirstOrDefaultAsync(t => t.Id == request.TaskId); + + if (config == null) + throw new NotFoundException($"Не найдено задание с id: {request.TaskId}"); + + // изменение статуса робота + _robotConfigurationRepository.ChangeRobotStatus(request.RobotStatusCode, config); + + // если успех, изменяем статус задания на успех + if (request.RobotStatusCode == RobotStatusEnum.Complete) + { + _robotConfigurationRepository.ChangeTaskStatus(TaskStatusEnum.Ok, config); + // Тут нужно посмотреть, если этот шаблон был на переименование, удалить у него старое название, так как он успешно переименовался + if (config.RobotCode == (int)RobotsEnum.TemplateOrder) + { + var renaming = await _templateRenamePendingRepository.Get().FirstOrDefaultAsync(t => t.TemplateId == config.TemplateId); + if (renaming != null) + { + // Удаляем + _templateRenamePendingRepository.Remove(renaming); + _logger.LogInformation("Шаблон {TemplateId} успешно переименован. Запись TemplateRenamePending удалена.", config.TemplateId); + } + } + } + + if (!await _robotConfigurationRepository.CommitAsync()) + throw new DbErrorException("Ошибка при сохранении в БД"); + + + //записываем в лог робота + if (request.RobotStatusCode == RobotStatusEnum.InProgress || request.RobotStatusCode == RobotStatusEnum.Complete) + { + var historyLevel = request.RobotStatusCode == RobotStatusEnum.InProgress ? RobotHistoryLevelEnum.Start : RobotHistoryLevelEnum.Complete; + + var history = new RobotHistory + { + Id = Guid.NewGuid(), + HistoryLevel = (int)historyLevel, + TaskStatusCode = config.TaskStatusCode, + RobotConfigurationId = config.Id, + RobotIp = request.RobotIp, + RobotId = request.RobotId + }; + await _robotHistoryRepository.CreateAsync(history); + await _robotHistoryRepository.CommitAsync(); + } + + var configToResponse = await _robotConfigurationRepository.Get() + .AsNoTracking() + .Include(t => t.Robot) + .Include(t => t.TaskStatus) + .Include(t => t.RobotStatus) + .FirstOrDefaultAsync(t => t.Id == request.TaskId); + + return _mapper.Map(configToResponse); + } + } +} diff --git a/PARR.Core/Services/RobotTaskRobotStatus/Interfaces/IRobotTaskRobotStatusService.cs b/PARR.Core/Services/RobotTaskRobotStatus/Interfaces/IRobotTaskRobotStatusService.cs new file mode 100644 index 00000000..d6a77067 --- /dev/null +++ b/PARR.Core/Services/RobotTaskRobotStatus/Interfaces/IRobotTaskRobotStatusService.cs @@ -0,0 +1,17 @@ +using PARR.Domain.DTOs.RobotTaskRobotStatus; + +namespace PARR.Core.Services.RobotTaskRobotStatus.Interfaces +{ + /// + /// Сервис по изменению статуса выполнения задания роботами + /// + public interface IRobotTaskRobotStatusService + { + /// + /// Изменить статус выполнения задания роботом по ИД задания + /// + /// + /// + Task ChangeStatusAsync(ChangeRobotStatus request); + } +} diff --git a/PARR.DAL/Repositories/TemplateRepositories/TemplateRenamePendingRepository.cs b/PARR.DAL/Repositories/TemplateRepositories/TemplateRenamePendingRepository.cs index a1e0f023..cf931a3d 100644 --- a/PARR.DAL/Repositories/TemplateRepositories/TemplateRenamePendingRepository.cs +++ b/PARR.DAL/Repositories/TemplateRepositories/TemplateRenamePendingRepository.cs @@ -25,6 +25,12 @@ namespace PARR.DAL.Repositories.TemplateRepositories return _dataContext.TemplateRenamePendings; } + public void Remove(TemplateRenamePending obj) + { + _dataContext.TemplateRenamePendings.Remove(obj); + } + + public async Task CreateAsync(TemplateRenamePending obj) { try diff --git a/PARR.Domain/DTOs/RobotTaskRobotStatus/ChangeRobotStatus.cs b/PARR.Domain/DTOs/RobotTaskRobotStatus/ChangeRobotStatus.cs new file mode 100644 index 00000000..6192883a --- /dev/null +++ b/PARR.Domain/DTOs/RobotTaskRobotStatus/ChangeRobotStatus.cs @@ -0,0 +1,13 @@ +using PARR.Domain.Enums; + +namespace PARR.Domain.DTOs.RobotTaskRobotStatus +{ + /// + /// Изменить статус задания робота + /// + /// + /// + /// Идентификатор робота + /// IP адрес робота + public record ChangeRobotStatus(Guid TaskId, RobotStatusEnum RobotStatusCode, string? RobotId, string? RobotIp); +} diff --git a/PARR.Domain/DTOs/RobotTaskRobotStatus/RobotConfigurationResult.cs b/PARR.Domain/DTOs/RobotTaskRobotStatus/RobotConfigurationResult.cs new file mode 100644 index 00000000..478a5ebe --- /dev/null +++ b/PARR.Domain/DTOs/RobotTaskRobotStatus/RobotConfigurationResult.cs @@ -0,0 +1,23 @@ +using PARR.Domain.DTOs.Shared; + +namespace PARR.Domain.DTOs.RobotTaskRobotStatus +{ + public record RobotConfigurationResult + { + public Guid Id { get; init; } + + public DateTimeOffset DateCreated { get; init; } + + public Guid TemplateId { get; init; } + + public RobotDto? Robot { get; init; } + + public RobotTaskStatusDto? TaskStatus { get; init; } + + public RobotStatusDto? RobotStatus { get; init; } + + public int AttemptsNumber { get; init; } + + public DateTimeOffset? LastRobotStatusUpdated { get; init; } + } +} diff --git a/PARR.Domain/DTOs/Shared/RobotDto.cs b/PARR.Domain/DTOs/Shared/RobotDto.cs new file mode 100644 index 00000000..32df50c6 --- /dev/null +++ b/PARR.Domain/DTOs/Shared/RobotDto.cs @@ -0,0 +1,9 @@ +namespace PARR.Domain.DTOs.Shared +{ + public record RobotDto + { + public int Code { get; init; } + public required string Name { get; init; } + public required string Description { get; init; } + } +} diff --git a/PARR.Domain/DTOs/Shared/RobotStatusDto.cs b/PARR.Domain/DTOs/Shared/RobotStatusDto.cs new file mode 100644 index 00000000..deb6a64f --- /dev/null +++ b/PARR.Domain/DTOs/Shared/RobotStatusDto.cs @@ -0,0 +1,9 @@ +namespace PARR.Domain.DTOs.Shared +{ + public record RobotStatusDto + { + public int Code { get; init; } + public string? Name { get; init; } + public string? Description { get; init; } + } +} diff --git a/PARR.Domain/DTOs/Shared/RobotTaskStatusDto.cs b/PARR.Domain/DTOs/Shared/RobotTaskStatusDto.cs new file mode 100644 index 00000000..f0f768e6 --- /dev/null +++ b/PARR.Domain/DTOs/Shared/RobotTaskStatusDto.cs @@ -0,0 +1,9 @@ +namespace PARR.Domain.DTOs.Shared +{ + public record RobotTaskStatusDto + { + public int Code { get; init; } + public required string Name { get; init; } + public required string Description { get; init; } + } +}