TelemetryDataBaseService.GetRangeAsync восстановлен для Witsml.

This commit is contained in:
ngfrolov 2023-11-01 17:45:25 +05:00
parent 17216acb80
commit 05de113e9e
Signed by: ng.frolov
GPG Key ID: E99907A0357B29A7
3 changed files with 9 additions and 4 deletions

View File

@ -44,7 +44,7 @@ namespace AsbCloudApp.Services
/// <param name="leDate"></param> /// <param name="leDate"></param>
/// <param name="token"></param> /// <param name="token"></param>
/// <returns></returns> /// <returns></returns>
Task<DatesRangeDto> GetRangeAsync(int idWell, DateTimeOffset geDate, DateTimeOffset? leDate, CancellationToken token); Task<DatesRangeDto?> GetRangeAsync(int idWell, DateTimeOffset geDate, DateTimeOffset? leDate, CancellationToken token);
/// <summary> /// <summary>
/// Период за который есть данные по скважине /// Период за который есть данные по скважине

View File

@ -205,7 +205,7 @@ namespace AsbCloudInfrastructure.Services.SAUB
} }
/// <inheritdoc/> /// <inheritdoc/>
public async Task<DatesRangeDto> GetRangeAsync(int idWell, DateTimeOffset geDate, DateTimeOffset? leDate, CancellationToken token) public async Task<DatesRangeDto?> GetRangeAsync(int idWell, DateTimeOffset geDate, DateTimeOffset? leDate, CancellationToken token)
{ {
var telemetry = telemetryService.GetOrDefaultTelemetryByIdWell(idWell) var telemetry = telemetryService.GetOrDefaultTelemetryByIdWell(idWell)
?? throw new ArgumentInvalidException(nameof(idWell), $"По скважине id:{idWell} нет телеметрии"); ?? throw new ArgumentInvalidException(nameof(idWell), $"По скважине id:{idWell} нет телеметрии");
@ -242,7 +242,9 @@ namespace AsbCloudInfrastructure.Services.SAUB
MaxDate = group.Max(entity => entity.DateTime), MaxDate = group.Max(entity => entity.DateTime),
}); });
var result = await gquery.FirstAsync(token); var result = await gquery.FirstOrDefaultAsync(token);
if (result is null)
return null;
var range = new DatesRangeDto var range = new DatesRangeDto
{ {

View File

@ -136,6 +136,8 @@ namespace AsbCloudWebApi.Controllers.SAUB
/// <param name="token"></param> /// <param name="token"></param>
/// <returns></returns> /// <returns></returns>
[HttpGet("{idWell}/dateRange")] [HttpGet("{idWell}/dateRange")]
[ProducesResponseType(typeof(DatesRangeDto), (int)System.Net.HttpStatusCode.OK)]
[ProducesResponseType((int)System.Net.HttpStatusCode.NotFound)]
public virtual async Task<ActionResult<DatesRangeDto?>> GetRangeAsync( public virtual async Task<ActionResult<DatesRangeDto?>> GetRangeAsync(
[FromRoute] int idWell, [FromRoute] int idWell,
[Required] DateTimeOffset geDate, [Required] DateTimeOffset geDate,
@ -167,7 +169,8 @@ namespace AsbCloudWebApi.Controllers.SAUB
[HttpGet("{idWell}/datesRange")] [HttpGet("{idWell}/datesRange")]
[Permission] [Permission]
[ProducesResponseType(typeof(DatesRangeDto), (int)System.Net.HttpStatusCode.OK)] [ProducesResponseType(typeof(DatesRangeDto), (int)System.Net.HttpStatusCode.OK)]
public virtual async Task<ActionResult<DatesRangeDto>> GetDataDatesRangeAsync(int idWell, [ProducesResponseType((int)System.Net.HttpStatusCode.NotFound)]
public virtual async Task<ActionResult<DatesRangeDto?>> GetDataDatesRangeAsync(int idWell,
CancellationToken token) CancellationToken token)
{ {
int? idCompany = User.GetCompanyId(); int? idCompany = User.GetCompanyId();