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

This commit is contained in:
ngfrolov 2023-11-01 17:45:25 +05:00
parent 17216acb80
commit 05de113e9e
Signed by untrusted user who does not match committer: 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="token"></param>
/// <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>
/// Период за который есть данные по скважине

View File

@ -205,7 +205,7 @@ namespace AsbCloudInfrastructure.Services.SAUB
}
/// <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)
?? throw new ArgumentInvalidException(nameof(idWell), $"По скважине id:{idWell} нет телеметрии");
@ -242,7 +242,9 @@ namespace AsbCloudInfrastructure.Services.SAUB
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
{

View File

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