From 2f1b8ee87ba378b3aebc73ae6a323c0e8ab786e6 Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Mon, 19 Feb 2024 10:32:15 +0500 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B0=D0=B7=D0=B4=D0=B5=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20dto=20=D0=B4=D0=BB=D1=8F=20drill=5Ftest=20?= =?UTF-8?q?=D0=BD=D0=B0=20DrillTestBaseDto=20=D0=B8=20DrillTestDto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudApp/Data/SAUB/DrillTestBaseDto.cs | 37 +++++++++++++++++++ AsbCloudApp/Data/SAUB/DrillTestDto.cs | 33 ++--------------- .../Repositories/IDrillTestRepository.cs | 2 +- .../Repository/DrillTestRepository.cs | 2 +- .../Controllers/DrillTestController.cs | 4 +- .../SignalR/Clients/ITelemetryHubClient.cs | 2 +- 6 files changed, 44 insertions(+), 36 deletions(-) create mode 100644 AsbCloudApp/Data/SAUB/DrillTestBaseDto.cs diff --git a/AsbCloudApp/Data/SAUB/DrillTestBaseDto.cs b/AsbCloudApp/Data/SAUB/DrillTestBaseDto.cs new file mode 100644 index 00000000..6e9f56bf --- /dev/null +++ b/AsbCloudApp/Data/SAUB/DrillTestBaseDto.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; + +namespace AsbCloudApp.Data.SAUB +{ + /// + /// DTO для получения записи drill_test из панели + /// + public class DrillTestBaseDto + { + /// + /// Идентификатор drill test + /// + [Required] + public int Id { get; set; } + + /// + /// Время начала drill test + /// + [Required] + public DateTimeOffset TimeStampStart { get; set; } + + /// + /// Глубина начала drill test + /// + [Required] + public float DepthStart { get; set; } + + /// + /// Параметры теста + /// + [Required] + public IEnumerable Params { get; set; } = Enumerable.Empty(); + } +} diff --git a/AsbCloudApp/Data/SAUB/DrillTestDto.cs b/AsbCloudApp/Data/SAUB/DrillTestDto.cs index 05e0aa09..0af9cb9c 100644 --- a/AsbCloudApp/Data/SAUB/DrillTestDto.cs +++ b/AsbCloudApp/Data/SAUB/DrillTestDto.cs @@ -1,42 +1,15 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; +using System.ComponentModel.DataAnnotations; namespace AsbCloudApp.Data.SAUB { /// - /// DTO для описания записи drill_test + /// DTO для отображения записи drill_test /// - public class DrillTestDto + public class DrillTestDto : DrillTestBaseDto { - /// - /// Идентификатор drill test - /// - [Required] - public int Id { get; set; } - - /// - /// Время начала drill test - /// - [Required] - public DateTimeOffset TimeStampStart { get; set; } - - /// - /// Глубина начала drill test - /// - [Required] - public float DepthStart { get; set; } - /// /// Связанная с drill_test телеметрия /// public TelemetryDto? Telemetry { get; set; } - - /// - /// Параметры теста - /// - [Required] - public IEnumerable Params { get; set; } = Enumerable.Empty(); } } diff --git a/AsbCloudApp/Repositories/IDrillTestRepository.cs b/AsbCloudApp/Repositories/IDrillTestRepository.cs index 9c7a2f50..22f11a06 100644 --- a/AsbCloudApp/Repositories/IDrillTestRepository.cs +++ b/AsbCloudApp/Repositories/IDrillTestRepository.cs @@ -36,6 +36,6 @@ namespace AsbCloudApp.Repositories /// запись drill test /// /// - Task SaveDataAsync(int idTelemetry, DrillTestDto dto, CancellationToken token); + Task SaveDataAsync(int idTelemetry, DrillTestBaseDto dto, CancellationToken token); } } diff --git a/AsbCloudInfrastructure/Repository/DrillTestRepository.cs b/AsbCloudInfrastructure/Repository/DrillTestRepository.cs index f5fb4ece..d8700929 100644 --- a/AsbCloudInfrastructure/Repository/DrillTestRepository.cs +++ b/AsbCloudInfrastructure/Repository/DrillTestRepository.cs @@ -63,7 +63,7 @@ namespace AsbCloudInfrastructure.Repository return dto; } - public async Task SaveDataAsync(int idTelemetry, DrillTestDto dto, CancellationToken token) + public async Task SaveDataAsync(int idTelemetry, DrillTestBaseDto dto, CancellationToken token) { var entity = dto.Adapt(); entity.IdTelemetry = idTelemetry; diff --git a/AsbCloudWebApi/Controllers/DrillTestController.cs b/AsbCloudWebApi/Controllers/DrillTestController.cs index 2d9585dc..8562e54c 100644 --- a/AsbCloudWebApi/Controllers/DrillTestController.cs +++ b/AsbCloudWebApi/Controllers/DrillTestController.cs @@ -58,7 +58,7 @@ public class DrillTestController : ControllerBase [HttpPost("api/telemetry/{uid}/[controller]")] public async Task PostDataAsync( string uid, - [FromBody] DrillTestDto dto, + [FromBody] DrillTestBaseDto dto, CancellationToken token) { var telemetry = telemetryService.GetOrCreateTelemetryByUid(uid); @@ -85,7 +85,6 @@ public class DrillTestController : ControllerBase /// /// [HttpGet("api/well/{idWell}/[controller]")] - [Permission] [ProducesResponseType(typeof(PhysicalFileResult), (int)HttpStatusCode.OK, "application/octet-stream")] [ProducesResponseType(StatusCodes.Status204NoContent)] public async Task GenerateReportAsync([FromRoute] int idWell, @@ -108,7 +107,6 @@ public class DrillTestController : ControllerBase /// /// [HttpGet("api/well/{idWell}/[controller]/all")] - [Permission] [ProducesResponseType(typeof(PaginationContainer), (int)HttpStatusCode.OK)] public async Task GetListAsync([FromRoute][Required] int idWell, [FromQuery] FileReportRequest request, diff --git a/AsbCloudWebApi/SignalR/Clients/ITelemetryHubClient.cs b/AsbCloudWebApi/SignalR/Clients/ITelemetryHubClient.cs index 251b1a61..2e831d1e 100644 --- a/AsbCloudWebApi/SignalR/Clients/ITelemetryHubClient.cs +++ b/AsbCloudWebApi/SignalR/Clients/ITelemetryHubClient.cs @@ -20,7 +20,7 @@ namespace AsbCloudWebApi.SignalR.Clients /// /// /// - Task ReceiveDrilltestData(DrillTestDto dto, CancellationToken token); + Task ReceiveDrilltestData(DrillTestBaseDto dto, CancellationToken token); /// /// Обновление записей РТК