forked from ddrilling/AsbCloudServer
Переименовал класс запроса + удалил неиспользуемое поле
This commit is contained in:
parent
bf8b7f9c0f
commit
7a6f922a97
@ -1,14 +1,13 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace AsbCloudApp.Requests
|
namespace AsbCloudApp.Requests
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// класс с фильтрами для запроса
|
/// класс с фильтрами для запроса
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SubsystemTimeRequest: RequestBase, IValidatableObject
|
public class SubsystemRequest: RequestBase, IValidatableObject
|
||||||
{
|
{
|
||||||
private static readonly DateTime validationMinDate = new DateTime(2020,01,01,0,0,0,DateTimeKind.Utc);
|
private static readonly DateTime validationMinDate = new DateTime(2020,01,01,0,0,0,DateTimeKind.Utc);
|
||||||
|
|
||||||
@ -18,11 +17,6 @@ namespace AsbCloudApp.Requests
|
|||||||
[Required]
|
[Required]
|
||||||
public int IdWell { get; set; }
|
public int IdWell { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// идентификатор подсистемы
|
|
||||||
/// </summary>
|
|
||||||
public IEnumerable<int> IdsSubsystems { get; set; } = Enumerable.Empty<int>();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Больше или равно дате
|
/// Больше или равно дате
|
||||||
/// </summary>
|
/// </summary>
|
@ -18,7 +18,7 @@ public interface ISubsystemService
|
|||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IEnumerable<SubsystemStatDto>> GetStatAsync(SubsystemTimeRequest request, CancellationToken token);
|
Task<IEnumerable<SubsystemStatDto>> GetStatAsync(SubsystemRequest request, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получение статистики по наработке подсистем по активным скважинам
|
/// Получение статистики по наработке подсистем по активным скважинам
|
||||||
|
@ -310,12 +310,12 @@ public class DailyReportService : IDailyReportService
|
|||||||
|
|
||||||
async Task<IEnumerable<SubsystemRecordDto>> GetSubsystemsAsync()
|
async Task<IEnumerable<SubsystemRecordDto>> GetSubsystemsAsync()
|
||||||
{
|
{
|
||||||
var subsystemsStatPerWell = await subsystemService.GetStatAsync(new SubsystemTimeRequest
|
var subsystemsStatPerWell = await subsystemService.GetStatAsync(new SubsystemRequest
|
||||||
{
|
{
|
||||||
IdWell = dailyReport.IdWell
|
IdWell = dailyReport.IdWell
|
||||||
}, cancellationToken);
|
}, cancellationToken);
|
||||||
|
|
||||||
var subsystemsStatPerDay = await subsystemService.GetStatAsync(new SubsystemTimeRequest
|
var subsystemsStatPerDay = await subsystemService.GetStatAsync(new SubsystemRequest
|
||||||
{
|
{
|
||||||
IdWell = dailyReport.IdWell,
|
IdWell = dailyReport.IdWell,
|
||||||
GeDate = dailyReport.Date,
|
GeDate = dailyReport.Date,
|
||||||
|
@ -39,7 +39,7 @@ internal class SubsystemService : ISubsystemService
|
|||||||
this.telemetryDataSaubService = telemetryDataSaubService;
|
this.telemetryDataSaubService = telemetryDataSaubService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<SubsystemStatDto>> GetStatAsync(SubsystemTimeRequest request, CancellationToken token)
|
public async Task<IEnumerable<SubsystemStatDto>> GetStatAsync(SubsystemRequest request, CancellationToken token)
|
||||||
{
|
{
|
||||||
var well = await wellService.GetOrDefaultAsync(request.IdWell, token)
|
var well = await wellService.GetOrDefaultAsync(request.IdWell, token)
|
||||||
?? throw new ArgumentInvalidException(nameof(request.IdWell), $"Well Id: {request.IdWell} does not exist");
|
?? throw new ArgumentInvalidException(nameof(request.IdWell), $"Well Id: {request.IdWell} does not exist");
|
||||||
|
@ -275,7 +275,7 @@ public class DailyReportServiceTest
|
|||||||
detectedOperationServiceMock.GetAsync(Arg.Any<DetectedOperationRequest>(), Arg.Any<CancellationToken>())
|
detectedOperationServiceMock.GetAsync(Arg.Any<DetectedOperationRequest>(), Arg.Any<CancellationToken>())
|
||||||
.ReturnsForAnyArgs(fakeWellOperationSlipsTime);
|
.ReturnsForAnyArgs(fakeWellOperationSlipsTime);
|
||||||
|
|
||||||
subsystemServiceMock.GetStatAsync(Arg.Any<SubsystemTimeRequest>(), Arg.Any<CancellationToken>())
|
subsystemServiceMock.GetStatAsync(Arg.Any<SubsystemRequest>(), Arg.Any<CancellationToken>())
|
||||||
.ReturnsForAnyArgs(new[] { fakeSubsystemsStat });
|
.ReturnsForAnyArgs(new[] { fakeSubsystemsStat });
|
||||||
|
|
||||||
scheduleRepositoryMock.GetAsync(idWell, dateDailyReport, Arg.Any<CancellationToken>())
|
scheduleRepositoryMock.GetAsync(idWell, dateDailyReport, Arg.Any<CancellationToken>())
|
||||||
|
@ -38,7 +38,7 @@ namespace AsbCloudWebApi.Controllers.Subsystems
|
|||||||
[HttpGet("stat")]
|
[HttpGet("stat")]
|
||||||
[ProducesResponseType(typeof(IEnumerable<SubsystemStatDto>), (int)System.Net.HttpStatusCode.OK)]
|
[ProducesResponseType(typeof(IEnumerable<SubsystemStatDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||||
[ProducesResponseType(typeof(ValidationProblemDetails), (int)System.Net.HttpStatusCode.BadRequest)]
|
[ProducesResponseType(typeof(ValidationProblemDetails), (int)System.Net.HttpStatusCode.BadRequest)]
|
||||||
public async Task<IActionResult> GetStatAsync([FromQuery] SubsystemTimeRequest request, CancellationToken token)
|
public async Task<IActionResult> GetStatAsync([FromQuery] SubsystemRequest request, CancellationToken token)
|
||||||
{
|
{
|
||||||
if (!await UserHasAccessToWellAsync(request.IdWell, token))
|
if (!await UserHasAccessToWellAsync(request.IdWell, token))
|
||||||
return Forbid();
|
return Forbid();
|
||||||
|
Loading…
Reference in New Issue
Block a user