Clean and doc

This commit is contained in:
Фролов 2021-08-20 14:17:53 +05:00
parent 322208e2b5
commit cec8e92d77
4 changed files with 2 additions and 53 deletions

View File

@ -6,15 +6,10 @@ namespace AsbCloudApp.Services
{
public interface IWellSectionService
{
Task<string[]> GetTypesAsync(CancellationToken token);
Task<PaginationContainer<WellOperationsDto>> GetAggregatedWellByWellIdAsync(int idWell,
int skip, int take, CancellationToken token);
Task<PaginationContainer<WellSectionDto>> GetSectionsByWellIdAsync(int idWell, int skip = 0, int take = 32,
CancellationToken token = default);
Task<WellSectionDto> GetSectionByWellIdAsync(int id, CancellationToken token = default);
//Task<WellSectionDto> InsertAsync(WellSectionDto newItem, int idWell, CancellationToken token = default);
//Task<IEnumerable<WellSectionDto>> InsertRangeAsync(int idWell, IEnumerable<WellSectionDto> newItems, CancellationToken token = default);
//Task<WellSectionDto> UpdateAsync(int idWell, int idSection, WellSectionDto item, CancellationToken token = default);
//Task<int> DeleteAsync(IEnumerable<int> ids, CancellationToken token = default);
}
}

View File

@ -23,9 +23,6 @@ namespace AsbCloudInfrastructure.Services
cachedSectionsTypes = cache.GetCachedTable<WellSectionType>((DbContext)db);
}
public Task<string[]> GetTypesAsync(CancellationToken token) =>
db.WellSectionTypes.Select(e => e.Caption).Distinct().AsNoTracking().ToArrayAsync(token);
public async Task<PaginationContainer<WellOperationsDto>> GetAggregatedWellByWellIdAsync(int idWell,
int skip, int take, CancellationToken token)
{
@ -160,6 +157,7 @@ namespace AsbCloudInfrastructure.Services
dto.SectionType = entity.WellSectionType.Caption;
return dto;
}
private static PaginationContainer<Tdto> PaginateData<Tdto, TEntity>(IEnumerable<IGrouping<int, TEntity>> groupedCollection,
int skip, int take)
{

View File

@ -150,7 +150,7 @@ namespace AsbCloudWebApi.Controllers
}
/// <summary>
/// Удаляет файл с диска на сервере
/// Помечает файл как удаленный
/// </summary>
/// <param name="idWell">id скважины</param>
/// <param name="idFile">id запрашиваемого файла</param>

View File

@ -24,15 +24,6 @@ namespace AsbCloudWebApi.Controllers
this.wellService = wellService;
}
[HttpGet]
[Route("types")]
[ProducesResponseType(typeof(string[]), (int)System.Net.HttpStatusCode.OK)]
public async Task<IActionResult> GetTypesAsync(CancellationToken token = default)
{
var result = await sectionsService.GetTypesAsync(token).ConfigureAwait(false);
return Ok(result);
}
[HttpGet]
[Route("aggregated")]
[ProducesResponseType(typeof(PaginationContainer<WellOperationsDto>), (int)System.Net.HttpStatusCode.OK)]
@ -74,41 +65,6 @@ namespace AsbCloudWebApi.Controllers
return Ok(result);
}
//[HttpPost]
//[ProducesResponseType(typeof(IEnumerable<WellSectionDto>), (int)System.Net.HttpStatusCode.OK)]
//public async Task<IActionResult> InsertAsync(int idWell, [FromBody] IEnumerable<WellSectionDto> values,
// CancellationToken token = default)
//{
// if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
// return Forbid();
// var result = await sectionsService.InsertRangeAsync(idWell, values, token).ConfigureAwait(false);
// return Ok(result);
//}
//[HttpPut("{idSection}")]
//[ProducesResponseType(typeof(WellSectionDto), (int)System.Net.HttpStatusCode.OK)]
//public async Task<IActionResult> UpdateAsync(int idWell, int idSection, [FromBody] WellSectionDto value, CancellationToken token = default)
//{
// if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
// return Forbid();
// var result = await sectionsService.UpdateAsync(idWell, idSection, value, token).ConfigureAwait(false);
// return Ok(result);
//}
//[HttpDelete("{idSection}")]
//[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
//public async Task<IActionResult> DeleteAsync(int idWell, int idItem, CancellationToken token = default)
//{
// if (!await CanUserAccessToWellAsync(idWell,
// token).ConfigureAwait(false))
// return Forbid();
// var result = await sectionsService.DeleteAsync(new int[] { idItem }, token).ConfigureAwait(false);
// return Ok(result);
//}
private async Task<bool> CanUserAccessToWellAsync(int idWell, CancellationToken token = default)
{
int? idCompany = User.GetCompanyId();