WellOperation* remove default cancellation tokens

This commit is contained in:
ngfrolov 2022-12-22 11:26:19 +05:00
parent 7b0e6ce23d
commit 9eead7a757
3 changed files with 11 additions and 11 deletions

View File

@ -28,7 +28,7 @@ namespace AsbCloudApp.Services
/// <returns></returns>
Task<PaginationContainer<WellOperationDto>> GetOperationsAsync(
WellOperationRequest request,
CancellationToken token = default);
CancellationToken token);
/// <summary>
/// Получить статистику операции по скважине с группировкой по категориям
@ -38,7 +38,7 @@ namespace AsbCloudApp.Services
/// <returns></returns>
Task<IEnumerable<WellGroupOpertionDto>> GetGroupOperationsStatAsync(
WellOperationRequest request,
CancellationToken token = default);
CancellationToken token);
/// <summary>
/// Получить операцию по id
@ -46,7 +46,7 @@ namespace AsbCloudApp.Services
/// <param name="id"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<WellOperationDto> GetOrDefaultAsync(int id, CancellationToken token);
Task<WellOperationDto?> GetOrDefaultAsync(int id, CancellationToken token);
/// <summary>
/// Добавить несколько операций за один раз

View File

@ -78,7 +78,7 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
public async Task<PaginationContainer<WellOperationDto>> GetOperationsAsync(
WellOperationRequest request,
CancellationToken token = default)
CancellationToken token)
{
var timezone = wellService.GetTimezone(request.IdWell);
@ -124,7 +124,7 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
public async Task<IEnumerable<WellGroupOpertionDto>> GetGroupOperationsStatAsync(
WellOperationRequest request,
CancellationToken token = default)
CancellationToken token)
{
var query = BuildQuery(request);
var entities = await query
@ -176,7 +176,7 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
}
public async Task<WellOperationDto?> GetOrDefaultAsync(int id,
CancellationToken token = default)
CancellationToken token)
{
var entity = await db.WellOperations
.Include(s => s.WellSectionType)
@ -198,7 +198,7 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
public async Task<int> InsertRangeAsync(
IEnumerable<WellOperationDto> wellOperationDtos,
CancellationToken token = default)
CancellationToken token)
{
var firstOperation = wellOperationDtos
.FirstOrDefault();
@ -222,7 +222,7 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
}
public async Task<int> UpdateAsync(
WellOperationDto dto, CancellationToken token = default)
WellOperationDto dto, CancellationToken token)
{
var timezone = wellService.GetTimezone(dto.IdWell);
var entity = dto.Adapt<WellOperation>();
@ -233,7 +233,7 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
}
public async Task<int> DeleteAsync(IEnumerable<int> ids,
CancellationToken token = default)
CancellationToken token)
{
var query = db.WellOperations.Where(e => ids.Contains(e.Id));
db.WellOperations.RemoveRange(query);

View File

@ -123,7 +123,7 @@ namespace AsbCloudWebApi.Controllers
[Route("{idOperation}")]
[Permission]
[ProducesResponseType(typeof(WellOperationDto), (int)System.Net.HttpStatusCode.OK)]
public async Task<IActionResult> GetAsync(int idWell, int idOperation,
public async Task<IActionResult> GetOrDefaultAsync(int idWell, int idOperation,
CancellationToken token)
{
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
@ -320,7 +320,7 @@ namespace AsbCloudWebApi.Controllers
return File(stream, "application/octet-stream", fileName);
}
private async Task<bool> CanUserAccessToWellAsync(int idWell, CancellationToken token = default)
private async Task<bool> CanUserAccessToWellAsync(int idWell, CancellationToken token)
{
int? idCompany = User.GetCompanyId();
return idCompany is not null && await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,