Merge pull request 'Фикс: проверка ключа скважины в методе контроллера, а не в свойстве класса (т.к. на этом падал фронтенд)' (#38) from fix/filling-fact-operations-editor-fixes into dev

Reviewed-on: http://test.digitaldrilling.ru:8080/DDrilling/AsbCloudServer/pulls/38
Reviewed-by: Никита Фролов <ng.frolov@digitaldrilling.ru>
This commit is contained in:
Никита Фролов 2023-03-23 17:14:15 +05:00
commit dc8aa67344
2 changed files with 5 additions and 3 deletions

View File

@ -16,7 +16,6 @@ namespace AsbCloudApp.Data
/// <inheritdoc/>
[Required]
[Range(1, int.MaxValue, ErrorMessage = "Id скважины не может быть меньше 1")]
public int IdWell { get; set; }
/// <summary>

View File

@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
@ -199,8 +200,10 @@ namespace AsbCloudWebApi.Controllers
[HttpPost]
[Permission]
[ProducesResponseType(typeof(IEnumerable<WellOperationDto>), (int)System.Net.HttpStatusCode.OK)]
public async Task<IActionResult> InsertRangeAsync(int idWell, [FromBody] IEnumerable<WellOperationDto> values,
CancellationToken token)
public async Task<IActionResult> InsertRangeAsync(
[Range(1, int.MaxValue, ErrorMessage = "Id скважины не может быть меньше 1")] int idWell,
[FromBody] IEnumerable<WellOperationDto> values,
CancellationToken token)
{
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
return Forbid();