From 5222d763f9e1e7b98d0db273c4d069dcb7620c75 Mon Sep 17 00:00:00 2001 From: Mikhail Trubnikov Date: Thu, 29 Jan 2026 16:53:00 +1000 Subject: [PATCH] =?UTF-8?q?feat(api):=20=D0=BE=D0=BF=D1=82=D0=B8=D0=BC?= =?UTF-8?q?=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20=D0=B7=D0=B0=D0=BF=D1=80?= =?UTF-8?q?=D0=BE=D1=81=D0=BE=D0=B2=20=D0=BD=D0=B0=20=D0=BF=D0=BE=D0=BB?= =?UTF-8?q?=D1=83=D1=87=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=81=D0=BF=D0=B8=D1=81?= =?UTF-8?q?=D0=BA=D0=B0=20=D1=88=D0=B0=D0=B1=D0=BB=D0=BE=D0=BD=D0=BE=D0=B2?= =?UTF-8?q?,=20=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD=20response?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../V1/Requests/Queries/TemplateQuery.cs | 5 + .../V1/Responses/TemplateResponse.cs | 71 ++++--- PARR.API/Controllers/V1/TemplateController.cs | 199 +++++++++++++----- .../DomainToResponseProfile.cs | 30 ++- 4 files changed, 216 insertions(+), 89 deletions(-) diff --git a/PARR.API/Contracts/V1/Requests/Queries/TemplateQuery.cs b/PARR.API/Contracts/V1/Requests/Queries/TemplateQuery.cs index a80721b6..5e15b38f 100644 --- a/PARR.API/Contracts/V1/Requests/Queries/TemplateQuery.cs +++ b/PARR.API/Contracts/V1/Requests/Queries/TemplateQuery.cs @@ -30,6 +30,11 @@ namespace PARR.API.Contracts.V1.Requests.Queries /// Статус синхронизации шаблонов и расписаний /// public TemplateQuerySyncStatusEnum? SyncStatus { get; set; } + + /// + /// Применять шорткоды + /// + public bool? ApplyShortcode { get; set; } } /// diff --git a/PARR.API/Contracts/V1/Responses/TemplateResponse.cs b/PARR.API/Contracts/V1/Responses/TemplateResponse.cs index a21d5af8..ba278d57 100644 --- a/PARR.API/Contracts/V1/Responses/TemplateResponse.cs +++ b/PARR.API/Contracts/V1/Responses/TemplateResponse.cs @@ -1,6 +1,6 @@ namespace PARR.API.Contracts.V1.Responses { - public class TemplateResponse + public class TemplateBaseResponse { public Guid Id { get; set; } @@ -10,6 +10,46 @@ public bool IsActiveSchedule { get; set; } + public string? ScheduleEsppId { get; set; } + + public DateTimeOffset? LastRun { get; set; } + + public DateTimeOffset NextRun { get; set; } + + + /// + /// Рабочая группа (формируется из шорткода) + /// + public string? WorkGroup { get; set; } + + /// + /// ЗО, формируется из шорткода + /// + public string? ResponseArea { get; set; } + + public UnitWithAttributesResponse? Unit { get; set; } + + public TemplateStatusTypeResponse? StatusType { get; set; } + + public TemplateAgentResponse? Agent { get; set; } + + public List? SyncStatus { get; set; } + + public int OrderCount { get; set; } + + public bool IsAutoDistributionEnabled { get; set; } + } + + + public class TemplateListResponse : TemplateBaseResponse + { + + } + + + + public class TemplateResponse : TemplateBaseResponse + { public required string Category { get; set; } public required string Initiator { get; set; } @@ -24,29 +64,6 @@ public required string TemplateDuration { get; set; } - /// - /// Рабочая группа (формируется из шорткода) - /// - public required string WorkGroup { get; set; } - - /// - /// ЗО, формируется из шорткода - /// - public required string ResponseArea { get; set; } - - public TemplateAgentResponse? Agent { get; set; } - - public DateTimeOffset? LastRun { get; set; } - - public DateTimeOffset NextRun { get; set; } - - public bool IsAutoDistributionEnabled { get; set; } - - public string? ScheduleEsppId { get; set; } - - //public UnitResponse? Unit { get; set; } - public UnitWithAttributesResponse? Unit { get; set; } - public JobResponse? Job { get; set; } public ProcessResponse? Process { get; set; } @@ -55,8 +72,6 @@ public TnkResponse? Tnk { get; set; } - public List? SyncStatus { get; set; } - /// /// Расписание /// @@ -72,10 +87,6 @@ /// public ScheduleExcludeTypeCalendarResponse? ScheduleExcludeTypeCalendar { get; set; } - public int OrderCount { get; set; } - - public TemplateStatusTypeResponse? StatusType { get; set; } - public JobGroupDistributionConfigResponse? DistributionConfig { get; set; } } } diff --git a/PARR.API/Controllers/V1/TemplateController.cs b/PARR.API/Controllers/V1/TemplateController.cs index 78e27fa7..8dcdb24f 100644 --- a/PARR.API/Controllers/V1/TemplateController.cs +++ b/PARR.API/Controllers/V1/TemplateController.cs @@ -18,6 +18,7 @@ using PARR.DAL.DomainModels; using PARR.DAL.DomainServices.Shortcodes; using PARR.DAL.Models; using PARR.DAL.Services.Interfaces; +using System.Diagnostics; namespace PARR.API.Controllers.V1 { @@ -33,6 +34,7 @@ namespace PARR.API.Controllers.V1 private readonly IClientService clientService; private readonly ILogger logger; private readonly IShortcodesService shortcodesService; + private readonly IOrderService orderService; public TemplateController( IMapper mapper, @@ -40,7 +42,8 @@ namespace PARR.API.Controllers.V1 IRobotConfigurationService robotConfigurationService, IClientService clientService, ILogger logger, - IShortcodesService shortcodesService + IShortcodesService shortcodesService, + IOrderService orderService ) { this.mapper = mapper; @@ -49,6 +52,7 @@ namespace PARR.API.Controllers.V1 this.clientService = clientService; this.logger = logger; this.shortcodesService = shortcodesService; + this.orderService = orderService; } @@ -62,18 +66,31 @@ namespace PARR.API.Controllers.V1 { var paginationFilter = mapper.Map(paginationQuery); - IQueryable