forked from ddrilling/AsbCloudServer
Переименовал класс запроса + удалил неиспользуемое поле
This commit is contained in:
parent
bf8b7f9c0f
commit
7a6f922a97
@ -1,14 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
|
||||
namespace AsbCloudApp.Requests
|
||||
{
|
||||
/// <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);
|
||||
|
||||
@ -18,11 +17,6 @@ namespace AsbCloudApp.Requests
|
||||
[Required]
|
||||
public int IdWell { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// идентификатор подсистемы
|
||||
/// </summary>
|
||||
public IEnumerable<int> IdsSubsystems { get; set; } = Enumerable.Empty<int>();
|
||||
|
||||
/// <summary>
|
||||
/// Больше или равно дате
|
||||
/// </summary>
|
@ -18,7 +18,7 @@ public interface ISubsystemService
|
||||
/// <param name="request"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<SubsystemStatDto>> GetStatAsync(SubsystemTimeRequest request, CancellationToken token);
|
||||
Task<IEnumerable<SubsystemStatDto>> GetStatAsync(SubsystemRequest request, CancellationToken token);
|
||||
|
||||
/// <summary>
|
||||
/// Получение статистики по наработке подсистем по активным скважинам
|
||||
|
@ -310,12 +310,12 @@ public class DailyReportService : IDailyReportService
|
||||
|
||||
async Task<IEnumerable<SubsystemRecordDto>> GetSubsystemsAsync()
|
||||
{
|
||||
var subsystemsStatPerWell = await subsystemService.GetStatAsync(new SubsystemTimeRequest
|
||||
var subsystemsStatPerWell = await subsystemService.GetStatAsync(new SubsystemRequest
|
||||
{
|
||||
IdWell = dailyReport.IdWell
|
||||
}, cancellationToken);
|
||||
|
||||
var subsystemsStatPerDay = await subsystemService.GetStatAsync(new SubsystemTimeRequest
|
||||
var subsystemsStatPerDay = await subsystemService.GetStatAsync(new SubsystemRequest
|
||||
{
|
||||
IdWell = dailyReport.IdWell,
|
||||
GeDate = dailyReport.Date,
|
||||
|
@ -39,7 +39,7 @@ internal class SubsystemService : ISubsystemService
|
||||
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)
|
||||
?? 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>())
|
||||
.ReturnsForAnyArgs(fakeWellOperationSlipsTime);
|
||||
|
||||
subsystemServiceMock.GetStatAsync(Arg.Any<SubsystemTimeRequest>(), Arg.Any<CancellationToken>())
|
||||
subsystemServiceMock.GetStatAsync(Arg.Any<SubsystemRequest>(), Arg.Any<CancellationToken>())
|
||||
.ReturnsForAnyArgs(new[] { fakeSubsystemsStat });
|
||||
|
||||
scheduleRepositoryMock.GetAsync(idWell, dateDailyReport, Arg.Any<CancellationToken>())
|
||||
|
@ -38,7 +38,7 @@ namespace AsbCloudWebApi.Controllers.Subsystems
|
||||
[HttpGet("stat")]
|
||||
[ProducesResponseType(typeof(IEnumerable<SubsystemStatDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
[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))
|
||||
return Forbid();
|
||||
|
Loading…
Reference in New Issue
Block a user