diff --git a/AsbCloudApp/Requests/SubsystemBaseRequest.cs b/AsbCloudApp/Requests/SubsystemBaseRequest.cs index a083d434..56cc3e76 100644 --- a/AsbCloudApp/Requests/SubsystemBaseRequest.cs +++ b/AsbCloudApp/Requests/SubsystemBaseRequest.cs @@ -9,7 +9,7 @@ namespace AsbCloudApp.Requests; /// public class SubsystemBaseRequest: RequestBase, IValidatableObject { - private static readonly DateTimeOffset validationMinDate = new DateTimeOffset(2020,01,01,0,0,0, TimeSpan.Zero); + public static readonly DateTimeOffset ValidationMinDate = new DateTimeOffset(2020,01,01,0,0,0, TimeSpan.Zero); /// /// Больше или равно дате @@ -34,9 +34,9 @@ public class SubsystemBaseRequest: RequestBase, IValidatableObject /// public IEnumerable Validate(ValidationContext validationContext) { - if (GeDate.HasValue && GeDate < validationMinDate) + if (GeDate.HasValue && GeDate < ValidationMinDate) yield return new ValidationResult( - $"Должно быть больше {validationMinDate:O})", + $"Должно быть больше {ValidationMinDate:O})", new[] { nameof(GeDate) }); if (LeDate.HasValue && GeDate.HasValue) diff --git a/AsbCloudApp/Requests/SubsystemPlanFactRequest.cs b/AsbCloudApp/Requests/SubsystemPlanFactRequest.cs index ba7d2566..52b8833f 100644 --- a/AsbCloudApp/Requests/SubsystemPlanFactRequest.cs +++ b/AsbCloudApp/Requests/SubsystemPlanFactRequest.cs @@ -13,5 +13,6 @@ public class SubsystemPlanFactRequest: SubsystemBaseRequest /// /// идентификаторы скважин /// - public IEnumerable IdsWell { get; set; } = Enumerable.Empty(); + [Required] + public IEnumerable IdsWell { get; set; } = null!; } diff --git a/AsbCloudInfrastructure/Services/Subsystems/SubsystemService.cs b/AsbCloudInfrastructure/Services/Subsystems/SubsystemService.cs index 05711fe0..f5acee31 100644 --- a/AsbCloudInfrastructure/Services/Subsystems/SubsystemService.cs +++ b/AsbCloudInfrastructure/Services/Subsystems/SubsystemService.cs @@ -142,8 +142,8 @@ public class SubsystemService : ISubsystemService .ToDictionary(t => t.Id, t => t.IdWell); var dtNow = DateTimeOffset.UtcNow; - var geDate = request.GeDate ?? new DateTimeOffset(dtNow.Date); - var leDate = request.LeDate ?? geDate.AddDays(1).AddMinutes(-1); + var geDate = request.GeDate ?? SubsystemPlanFactRequest.ValidationMinDate; + var leDate = request.LeDate ?? DateTimeOffset.UtcNow; var telemetryDataSaub = await telemetryDataSaubService.Get(telemetriesDict.Keys, false, geDate, leDate, 100_000, token); var groupedTelemetryDataSaub = telemetryDataSaub