forked from ddrilling/AsbCloudServer
SetpointsRequestDto добавил атрибут валидации времени устаревания от 10мин до 4часов
This commit is contained in:
parent
eddac473c8
commit
aa002488fe
@ -39,7 +39,8 @@ namespace AsbCloudApp.Data.SAUB
|
||||
/// время в секундах актуальности этого запроса
|
||||
/// </summary>
|
||||
[Required]
|
||||
public int ObsolescenceSec { get; set; }
|
||||
[Range(10 * 60, 4 * 60 * 60)]
|
||||
public int ObsolescenceSec { get; set; } = 10 * 60;
|
||||
|
||||
/// <summary>
|
||||
/// набор уставок: {"название переменной панели"; "рекомендуемое значение"}
|
||||
|
@ -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");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user