From aa002488fe8afdb8cd2f88393a863ab46e3406ba Mon Sep 17 00:00:00 2001 From: ngfrolov Date: Fri, 16 Feb 2024 11:24:03 +0500 Subject: [PATCH] =?UTF-8?q?SetpointsRequestDto=20=D0=B4=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=B2=D0=B8=D0=BB=20=D0=B0=D1=82=D1=80=D0=B8=D0=B1=D1=83=D1=82?= =?UTF-8?q?=20=D0=B2=D0=B0=D0=BB=D0=B8=D0=B4=D0=B0=D1=86=D0=B8=D0=B8=20?= =?UTF-8?q?=D0=B2=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=B8=20=D1=83=D1=81=D1=82?= =?UTF-8?q?=D0=B0=D1=80=D0=B5=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=BE=D1=82?= =?UTF-8?q?=2010=D0=BC=D0=B8=D0=BD=20=D0=B4=D0=BE=204=D1=87=D0=B0=D1=81?= =?UTF-8?q?=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudApp/Data/SAUB/SetpointsRequestDto.cs | 3 ++- AsbCloudWebApi/Controllers/SAUB/SetpointsController.cs | 7 ------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/AsbCloudApp/Data/SAUB/SetpointsRequestDto.cs b/AsbCloudApp/Data/SAUB/SetpointsRequestDto.cs index 5ecb4932..ed81c0ef 100644 --- a/AsbCloudApp/Data/SAUB/SetpointsRequestDto.cs +++ b/AsbCloudApp/Data/SAUB/SetpointsRequestDto.cs @@ -39,7 +39,8 @@ namespace AsbCloudApp.Data.SAUB /// время в секундах актуальности этого запроса /// [Required] - public int ObsolescenceSec { get; set; } + [Range(10 * 60, 4 * 60 * 60)] + public int ObsolescenceSec { get; set; } = 10 * 60; /// /// набор уставок: {"название переменной панели"; "рекомендуемое значение"} diff --git a/AsbCloudWebApi/Controllers/SAUB/SetpointsController.cs b/AsbCloudWebApi/Controllers/SAUB/SetpointsController.cs index 996c8298..59711fa3 100644 --- a/AsbCloudWebApi/Controllers/SAUB/SetpointsController.cs +++ b/AsbCloudWebApi/Controllers/SAUB/SetpointsController.cs @@ -18,8 +18,6 @@ namespace AsbCloudWebApi.Controllers.SAUB { private readonly ISetpointsService setpointsService; private readonly IWellService wellService; - private const int ObsolescenceSecMin = 30; - private const int ObsolescenceSecMax = 6 * 60 * 60; public SetpointsController(ISetpointsService setpointsService, IWellService wellService) { @@ -68,11 +66,6 @@ namespace AsbCloudWebApi.Controllers.SAUB setpoints.IdWell = idWell; setpoints.IdState = 1; - if (setpoints is null - || setpoints.ObsolescenceSec > ObsolescenceSecMax - || setpoints.ObsolescenceSec < ObsolescenceSecMin) - return this.ValidationBadRequest(nameof(setpoints.ObsolescenceSec), "Wrong ObsolescenceSec"); - if (!setpoints.Setpoints.Any()) return this.ValidationBadRequest(nameof(setpoints.Setpoints), "Wrong setpoints count");