forked from ddrilling/AsbCloudServer
Fixed Measure controller to return all measure history at once
This commit is contained in:
parent
5b41d017a1
commit
1f4a55c5df
@ -9,7 +9,7 @@ namespace AsbCloudApp.Services
|
|||||||
{
|
{
|
||||||
Task<Dictionary<int, string>> GetCategoriesAsync(CancellationToken token);
|
Task<Dictionary<int, string>> GetCategoriesAsync(CancellationToken token);
|
||||||
Task<MeasureDto> GetLastAsync(int idWell, int idCategory, CancellationToken token);
|
Task<MeasureDto> GetLastAsync(int idWell, int idCategory, CancellationToken token);
|
||||||
Task<IEnumerable<MeasureDto>> GetHisoryAsync(int idWell, int idCategory, CancellationToken token);
|
Task<IEnumerable<MeasureDto>> GetHisoryAsync(int idWell, CancellationToken token);
|
||||||
Task<IEnumerable<MeasureDto>> GetAllLastAsync(int idWell, CancellationToken token);
|
Task<IEnumerable<MeasureDto>> GetAllLastAsync(int idWell, CancellationToken token);
|
||||||
Task<int> InsertAsync(int idWell, MeasureDto data, CancellationToken token);
|
Task<int> InsertAsync(int idWell, MeasureDto data, CancellationToken token);
|
||||||
Task<int> UpdateAsync(int idWell, MeasureDto data, CancellationToken token);
|
Task<int> UpdateAsync(int idWell, MeasureDto data, CancellationToken token);
|
||||||
|
@ -83,10 +83,10 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
return dtos;
|
return dtos;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<MeasureDto>> GetHisoryAsync(int idWell, int idCategory, CancellationToken token)
|
public async Task<IEnumerable<MeasureDto>> GetHisoryAsync(int idWell, CancellationToken token)
|
||||||
{
|
{
|
||||||
var query = db.Measures.Include(m => m.Category)
|
var query = db.Measures.Include(m => m.Category)
|
||||||
.Where(m => m.IdWell == idWell && m.IdCategory == idCategory && !m.IsDeleted);
|
.Where(m => m.IdWell == idWell && !m.IsDeleted);
|
||||||
|
|
||||||
var entities = await query
|
var entities = await query
|
||||||
.AsNoTracking()
|
.AsNoTracking()
|
||||||
|
@ -55,13 +55,13 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("history/{idCategory}")]
|
[Route("history")]
|
||||||
public async Task<IActionResult> GetHisoryAsync([FromRoute] int idWell, [FromRoute] int idCategory, CancellationToken token = default)
|
public async Task<IActionResult> GetHisoryAsync([FromRoute] int idWell, [FromRoute] int idCategory, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||||
return Forbid();
|
return Forbid();
|
||||||
|
|
||||||
var result = await measureService.GetHisoryAsync(idWell, idCategory, token).ConfigureAwait(false);
|
var result = await measureService.GetHisoryAsync(idWell, token).ConfigureAwait(false);
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user