forked from ddrilling/AsbCloudServer
StatController mathod renames
This commit is contained in:
parent
e55f505ea7
commit
85ff9a5903
@ -7,7 +7,7 @@ namespace AsbCloudApp.Services
|
||||
{
|
||||
public interface IWellOperationsStatService
|
||||
{
|
||||
Task<StatClusterDto> GetOperationStatByClusterAsync(int idCluster, CancellationToken token = default);
|
||||
Task<StatWellDto> GetOperationStatByWellAsync(int idWell, CancellationToken token = default);
|
||||
Task<StatClusterDto> GetStatClusterAsync(int idCluster, CancellationToken token = default);
|
||||
Task<StatWellDto> GetStatWellAsync(int idWell, CancellationToken token = default);
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
cacheCluster = cache.GetCachedTable<Cluster>((DbContext)db);
|
||||
}
|
||||
|
||||
public async Task<StatClusterDto> GetOperationStatByClusterAsync(int idCluster, CancellationToken token = default)
|
||||
public async Task<StatClusterDto> GetStatClusterAsync(int idCluster, CancellationToken token = default)
|
||||
{
|
||||
var operations = await db.WellOperations
|
||||
.Where(o => o.Well.IdCluster == idCluster)
|
||||
@ -106,7 +106,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
return statClusterDto;
|
||||
}
|
||||
|
||||
public async Task<StatWellDto> GetOperationStatByWellAsync(int idWell,
|
||||
public async Task<StatWellDto> GetStatWellAsync(int idWell,
|
||||
CancellationToken token = default)
|
||||
{
|
||||
var operations = await db.WellOperations
|
||||
|
@ -25,35 +25,36 @@ namespace AsbCloudWebApi.Controllers
|
||||
this.wellService = wellService;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("well/{idWell}/stat")]
|
||||
[ProducesResponseType(typeof(IEnumerable<StatOperationsDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetOperationStatByWellAsync(int idWell,
|
||||
CancellationToken token = default)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
|
||||
var result = await sectionsService.GetOperationStatByWellAsync(idWell, token)
|
||||
.ConfigureAwait(false);
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("cluster/{idCluster}/stat")]
|
||||
[ProducesResponseType(typeof(StatClusterDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetOperationStatByClusterAsync(int idCluster,
|
||||
public async Task<IActionResult> GetStatClusterAsync(int idCluster,
|
||||
CancellationToken token = default)
|
||||
{
|
||||
// TODO: Fix next commented lines
|
||||
//if (!await CanUserAccessToWellAsync(idCluster, token).ConfigureAwait(false))
|
||||
// return Forbid();
|
||||
|
||||
var result = await sectionsService.GetOperationStatByClusterAsync(idCluster, token)
|
||||
var result = await sectionsService.GetStatClusterAsync(idCluster, token)
|
||||
.ConfigureAwait(false);
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("well/{idWell}/stat")]
|
||||
[ProducesResponseType(typeof(StatWellDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetStatWellAsync(int idWell,
|
||||
CancellationToken token = default)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
|
||||
var result = await sectionsService.GetStatWellAsync(idWell, token)
|
||||
.ConfigureAwait(false);
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
|
||||
private async Task<bool> CanUserAccessToWellAsync(int idWell, CancellationToken token = default)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
|
Loading…
Reference in New Issue
Block a user