forked from ddrilling/AsbCloudServer
Merge branch 'dev' into fix/info-rop-on-start-screen
This commit is contained in:
commit
5ead520f9e
@ -16,6 +16,7 @@ using AsbCloudApp.Requests.ExportOptions;
|
||||
using AsbCloudApp.Requests.ParserOptions;
|
||||
using AsbCloudDb.Model;
|
||||
using AsbCloudInfrastructure.Services.WellOperations.Factories;
|
||||
using System.Linq;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers;
|
||||
|
||||
@ -250,6 +251,35 @@ public class WellOperationController : ControllerBase
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Удаляет выбранные операции по скважине
|
||||
/// </summary>
|
||||
/// <param name="idWell">id скважины</param>
|
||||
/// <param name="ids">ids выбранных операций</param>
|
||||
/// <param name="token">Токен отмены задачи</param>
|
||||
/// <returns>Количество удаленных из БД строк</returns>
|
||||
[HttpDelete]
|
||||
[ProducesResponseType(typeof(int), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)]
|
||||
public async Task<IActionResult> DeleteRangeAsync([FromRoute] int idWell, IEnumerable<int> ids, CancellationToken token)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell, token))
|
||||
return Forbid();
|
||||
|
||||
if (!await CanUserEditWellOperationsAsync(idWell, token))
|
||||
return Forbid();
|
||||
|
||||
if (!ids.Any())
|
||||
return this.ValidationBadRequest(nameof(ids), "Пустой список операций");
|
||||
|
||||
var result = await wellOperationRepository.DeleteRangeAsync(ids, token);
|
||||
|
||||
if(result == ICrudRepository<WellOperationDto>.ErrorIdNotFound)
|
||||
return this.ValidationBadRequest(nameof(ids), "Минимум одна из операций не найдена в базе");
|
||||
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Формирование excel файла с операциями на скважине
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user