Разделение dto для drill_test на DrillTestBaseDto и DrillTestDto

This commit is contained in:
Olga Nemt 2024-02-19 10:32:15 +05:00
parent df8ddf3122
commit 2f1b8ee87b
6 changed files with 44 additions and 36 deletions

View File

@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
namespace AsbCloudApp.Data.SAUB
{
/// <summary>
/// DTO для получения записи drill_test из панели
/// </summary>
public class DrillTestBaseDto
{
/// <summary>
/// Идентификатор drill test
/// </summary>
[Required]
public int Id { get; set; }
/// <summary>
/// Время начала drill test
/// </summary>
[Required]
public DateTimeOffset TimeStampStart { get; set; }
/// <summary>
/// Глубина начала drill test
/// </summary>
[Required]
public float DepthStart { get; set; }
/// <summary>
/// Параметры теста
/// </summary>
[Required]
public IEnumerable<DrillTestParamsDto> Params { get; set; } = Enumerable.Empty<DrillTestParamsDto>();
}
}

View File

@ -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
{
/// <summary>
/// DTO для описания записи drill_test
/// DTO для отображения записи drill_test
/// </summary>
public class DrillTestDto
public class DrillTestDto : DrillTestBaseDto
{
/// <summary>
/// Идентификатор drill test
/// </summary>
[Required]
public int Id { get; set; }
/// <summary>
/// Время начала drill test
/// </summary>
[Required]
public DateTimeOffset TimeStampStart { get; set; }
/// <summary>
/// Глубина начала drill test
/// </summary>
[Required]
public float DepthStart { get; set; }
/// <summary>
/// Связанная с drill_test телеметрия
/// </summary>
public TelemetryDto? Telemetry { get; set; }
/// <summary>
/// Параметры теста
/// </summary>
[Required]
public IEnumerable<DrillTestParamsDto> Params { get; set; } = Enumerable.Empty<DrillTestParamsDto>();
}
}

View File

@ -36,6 +36,6 @@ namespace AsbCloudApp.Repositories
/// <param name="dto">запись drill test</param>
/// <param name="token"></param>
/// <returns></returns>
Task<int> SaveDataAsync(int idTelemetry, DrillTestDto dto, CancellationToken token);
Task<int> SaveDataAsync(int idTelemetry, DrillTestBaseDto dto, CancellationToken token);
}
}

View File

@ -63,7 +63,7 @@ namespace AsbCloudInfrastructure.Repository
return dto;
}
public async Task<int> SaveDataAsync(int idTelemetry, DrillTestDto dto, CancellationToken token)
public async Task<int> SaveDataAsync(int idTelemetry, DrillTestBaseDto dto, CancellationToken token)
{
var entity = dto.Adapt<DrillTest>();
entity.IdTelemetry = idTelemetry;

View File

@ -58,7 +58,7 @@ public class DrillTestController : ControllerBase
[HttpPost("api/telemetry/{uid}/[controller]")]
public async Task<IActionResult> PostDataAsync(
string uid,
[FromBody] DrillTestDto dto,
[FromBody] DrillTestBaseDto dto,
CancellationToken token)
{
var telemetry = telemetryService.GetOrCreateTelemetryByUid(uid);
@ -85,7 +85,6 @@ public class DrillTestController : ControllerBase
/// <param name="cancellationToken"></param>
/// <returns></returns>
[HttpGet("api/well/{idWell}/[controller]")]
[Permission]
[ProducesResponseType(typeof(PhysicalFileResult), (int)HttpStatusCode.OK, "application/octet-stream")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
public async Task<IActionResult> GenerateReportAsync([FromRoute] int idWell,
@ -108,7 +107,6 @@ public class DrillTestController : ControllerBase
/// <param name="cancellationToken"></param>
/// <returns></returns>
[HttpGet("api/well/{idWell}/[controller]/all")]
[Permission]
[ProducesResponseType(typeof(PaginationContainer<DrillTestReportInfoDto>), (int)HttpStatusCode.OK)]
public async Task<IActionResult> GetListAsync([FromRoute][Required] int idWell,
[FromQuery] FileReportRequest request,

View File

@ -20,7 +20,7 @@ namespace AsbCloudWebApi.SignalR.Clients
/// <param name="dto"></param>
/// <param name="token"></param>
/// <returns></returns>
Task ReceiveDrilltestData(DrillTestDto dto, CancellationToken token);
Task ReceiveDrilltestData(DrillTestBaseDto dto, CancellationToken token);
/// <summary>
/// Обновление записей РТК