forked from ddrilling/AsbCloudServer
Fixed DrillFlowChart routes, model, dto names
This commit is contained in:
parent
7c41fc5b91
commit
32732bf058
@ -2,7 +2,7 @@ using System;
|
||||
|
||||
namespace AsbCloudApp.Data
|
||||
{
|
||||
public class DrillFlowChartParamsDto : IId
|
||||
public class DrillFlowChartDto : IId
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@ -5,18 +6,18 @@ using AsbCloudApp.Data;
|
||||
|
||||
namespace AsbCloudApp.Services
|
||||
{
|
||||
public interface IDrillFlowChartService : ICrudService<DrillFlowChartParamsDto>
|
||||
public interface IDrillFlowChartService : ICrudService<DrillFlowChartDto>
|
||||
{
|
||||
Task<IEnumerable<DrillFlowChartParamsDto>> GetAllAsync(int idWell,
|
||||
CancellationToken token = default);
|
||||
Task<IEnumerable<DrillFlowChartDto>> GetAllAsync(int idWell,
|
||||
DateTime updateFrom, CancellationToken token = default);
|
||||
|
||||
Task<int> InsertAsync(int idWell, DrillFlowChartParamsDto dto,
|
||||
Task<int> InsertAsync(int idWell, DrillFlowChartDto dto,
|
||||
CancellationToken token = default);
|
||||
|
||||
Task<int> InsertRangeAsync(int idWell, IEnumerable<DrillFlowChartParamsDto> dtos,
|
||||
Task<int> InsertRangeAsync(int idWell, IEnumerable<DrillFlowChartDto> dtos,
|
||||
CancellationToken token = default);
|
||||
|
||||
Task<int> UpdateAsync(int idWell, int idDto, DrillFlowChartParamsDto dto,
|
||||
Task<int> UpdateAsync(int idWell, int idDto, DrillFlowChartDto dto,
|
||||
CancellationToken token = default);
|
||||
}
|
||||
}
|
@ -36,7 +36,7 @@ namespace AsbCloudDb.Model
|
||||
public virtual DbSet<WellSectionType> WellSectionTypes { get; set; }
|
||||
public virtual DbSet<WellType> WellTypes { get; set; }
|
||||
public virtual DbSet<DrillParams> DrillParams { get; set; }
|
||||
public virtual DbSet<DrillFlowChartParams> DrillFlowChartParams { get; set; }
|
||||
public virtual DbSet<DrillFlowChart> DrillFlowChart { get; set; }
|
||||
|
||||
//var options = new DbContextOptionsBuilder<AsbCloudDbContext>()
|
||||
// .UseNpgsql("Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True")
|
||||
|
@ -7,7 +7,7 @@ using System.Text.Json.Serialization;
|
||||
namespace AsbCloudDb.Model
|
||||
{
|
||||
[Table("t_drill_flow_chart_params"), Comment("Параметры корридоров бурения (диапазоны параметров бурения)")]
|
||||
public class DrillFlowChartParams : IId
|
||||
public class DrillFlowChart : IId
|
||||
{
|
||||
[Key]
|
||||
[Column("id")]
|
@ -34,7 +34,7 @@ namespace AsbCloudDb.Model
|
||||
DbSet<MeasureCategory> MeasureCategories { get; set; }
|
||||
DbSet<TelemetryDataSpin> TelemetryDataSpin { get; set; }
|
||||
DbSet<DrillParams> DrillParams { get; set; }
|
||||
DbSet<DrillFlowChartParams> DrillFlowChartParams { get; set; }
|
||||
DbSet<DrillFlowChart> DrillFlowChart { get; set; }
|
||||
|
||||
DatabaseFacade Database { get; }
|
||||
|
||||
|
@ -11,7 +11,7 @@ using Mapster;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services
|
||||
{
|
||||
public class DrillFlowChartService : CrudServiceBase<DrillFlowChartParamsDto, DrillFlowChartParams>,
|
||||
public class DrillFlowChartService : CrudServiceBase<DrillFlowChartDto, DrillFlowChart>,
|
||||
IDrillFlowChartService
|
||||
{
|
||||
private readonly IAsbCloudDbContext db;
|
||||
@ -24,21 +24,22 @@ namespace AsbCloudInfrastructure.Services
|
||||
this.telemetryService = telemetryService;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<DrillFlowChartParamsDto>> GetAllAsync(int idWell,
|
||||
CancellationToken token = default)
|
||||
public async Task<IEnumerable<DrillFlowChartDto>> GetAllAsync(int idWell,
|
||||
DateTime updateFrom, CancellationToken token = default)
|
||||
{
|
||||
var entities = await (from p in db.DrillFlowChartParams
|
||||
where p.IdWell == idWell
|
||||
var entities = await (from p in db.DrillFlowChart
|
||||
where p.IdWell == idWell &&
|
||||
p.LastUpdate >= updateFrom
|
||||
orderby p.Id
|
||||
select p)
|
||||
.ToListAsync(token)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
var dto = entities.Adapt<DrillFlowChartParamsDto>();
|
||||
var dto = entities.Adapt<DrillFlowChartDto>();
|
||||
return dto;
|
||||
}
|
||||
|
||||
public async Task<int> InsertAsync(int idWell, DrillFlowChartParamsDto dto,
|
||||
public async Task<int> InsertAsync(int idWell, DrillFlowChartDto dto,
|
||||
CancellationToken token = default)
|
||||
{
|
||||
dto.IdWell = idWell;
|
||||
@ -49,7 +50,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<int> InsertRangeAsync(int idWell, IEnumerable<DrillFlowChartParamsDto> dtos,
|
||||
public async Task<int> InsertRangeAsync(int idWell, IEnumerable<DrillFlowChartDto> dtos,
|
||||
CancellationToken token = default)
|
||||
{
|
||||
foreach (var dto in dtos)
|
||||
@ -63,7 +64,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<int> UpdateAsync(int idWell, int idDto, DrillFlowChartParamsDto dto,
|
||||
public async Task<int> UpdateAsync(int idWell, int idDto, DrillFlowChartDto dto,
|
||||
CancellationToken token = default)
|
||||
{
|
||||
dto.IdWell = idWell;
|
||||
|
@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@ -10,7 +11,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <summary>
|
||||
/// Контроллер для корридоров бурения на панели
|
||||
/// </summary>
|
||||
[Route("api/drillFlowChartParams/{idWell}")]
|
||||
[Route("api/well/{idWell}/drillFlowChart/")]
|
||||
[ApiController]
|
||||
public class DrillFlowChartController : ControllerBase
|
||||
{
|
||||
@ -30,11 +31,13 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// Возвращает все значения для корридоров бурения по id скважины
|
||||
/// </summary>
|
||||
/// <param name="idWell"> id скважины </param>
|
||||
/// <param name="updateFrom"> Дата, с которой следует искать новые параметры </param>
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns> Список параметров для корридоров бурения </returns>
|
||||
[HttpGet("paramsByIdWell")]
|
||||
[ProducesResponseType(typeof(IEnumerable<DrillFlowChartParamsDto>), (int) System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetAllAsync(int idWell, CancellationToken token = default)
|
||||
[HttpGet]
|
||||
[ProducesResponseType(typeof(IEnumerable<DrillFlowChartDto>), (int) System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetAllAsync(int idWell, DateTime updateFrom,
|
||||
CancellationToken token = default)
|
||||
{
|
||||
var idCompany = User.GetCompanyId();
|
||||
|
||||
@ -42,7 +45,8 @@ namespace AsbCloudWebApi.Controllers
|
||||
idWell, token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
|
||||
var dto = await drillFlowChartService.GetAllAsync(idWell, token);
|
||||
var dto = await drillFlowChartService.GetAllAsync(idWell,
|
||||
updateFrom, token);
|
||||
|
||||
return Ok(dto);
|
||||
}
|
||||
@ -51,11 +55,12 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// Возвращает все значения для корридоров бурения по uid панели
|
||||
/// </summary>
|
||||
/// <param name="uid"> uid панели </param>
|
||||
/// <param name="updateFrom"> Дата, с которой следует искать новые параметры </param>
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns> Список параметров для корридоров бурения </returns>
|
||||
[HttpGet]
|
||||
[ProducesResponseType(typeof(IEnumerable<DrillFlowChartParamsDto>), (int) System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetAllAsync(string uid, CancellationToken token = default)
|
||||
[HttpGet("{uid}")]
|
||||
[ProducesResponseType(typeof(IEnumerable<DrillFlowChartDto>), (int) System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetAllAsync(string uid, DateTime updateFrom, CancellationToken token = default)
|
||||
{
|
||||
var idCompany = User.GetCompanyId();
|
||||
|
||||
@ -65,7 +70,8 @@ namespace AsbCloudWebApi.Controllers
|
||||
(int)idWell, token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
|
||||
var dto = await drillFlowChartService.GetAllAsync((int)idWell, token);
|
||||
var dto = await drillFlowChartService.GetAllAsync((int)idWell,
|
||||
updateFrom, token);
|
||||
|
||||
return Ok(dto);
|
||||
}
|
||||
@ -74,13 +80,13 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// Сохраняет значения для корридоров бурения
|
||||
/// </summary>
|
||||
/// <param name="idWell"> id скважины </param>
|
||||
/// <param name="drillFlowChartParamsDto"> Параметры корридоров бурения</param>
|
||||
/// <param name="drillFlowChartDto"> Параметры корридоров бурения</param>
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[ProducesResponseType(typeof(int), (int) System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> InsertAsync(int idWell,
|
||||
DrillFlowChartParamsDto drillFlowChartParamsDto, CancellationToken token = default)
|
||||
DrillFlowChartDto drillFlowChartDto, CancellationToken token = default)
|
||||
{
|
||||
var idCompany = User.GetCompanyId();
|
||||
|
||||
@ -88,7 +94,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
idWell, token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
|
||||
var result = await drillFlowChartService.InsertAsync(idWell, drillFlowChartParamsDto, token);
|
||||
var result = await drillFlowChartService.InsertAsync(idWell, drillFlowChartDto, token);
|
||||
|
||||
return Ok(result);
|
||||
}
|
||||
@ -103,7 +109,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[HttpPost("range")]
|
||||
[ProducesResponseType(typeof(int), (int) System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> InsertRangeAsync(int idWell,
|
||||
IEnumerable<DrillFlowChartParamsDto> drillFlowChartParams, CancellationToken token = default)
|
||||
IEnumerable<DrillFlowChartDto> drillFlowChartParams, CancellationToken token = default)
|
||||
{
|
||||
var idCompany = User.GetCompanyId();
|
||||
|
||||
@ -121,13 +127,13 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// Изменяет значения выбранного корридора бурения
|
||||
/// </summary>
|
||||
/// <param name="idWell"> id скважины </param>
|
||||
/// <param name="drillFlowChartParams"> Параметры корридоров бурения</param>
|
||||
/// <param name="drillFlowChart"> Параметры корридоров бурения</param>
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
[ProducesResponseType(typeof(int), (int) System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> EditAsync(int idWell,
|
||||
DrillFlowChartParamsDto drillFlowChartParams, CancellationToken token = default)
|
||||
DrillFlowChartDto drillFlowChart, CancellationToken token = default)
|
||||
{
|
||||
var idCompany = User.GetCompanyId();
|
||||
|
||||
@ -136,7 +142,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
return Forbid();
|
||||
|
||||
var result = await drillFlowChartService.UpdateAsync(idWell,
|
||||
drillFlowChartParams, token);
|
||||
drillFlowChart, token);
|
||||
|
||||
return Ok(result);
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <summary>
|
||||
/// Контроллер для режимов бурения
|
||||
/// </summary>
|
||||
[Route("api/drillParams/{idWell}")]
|
||||
[Route("api/well/{idWell}/drillParams/")]
|
||||
[ApiController]
|
||||
public class DrillParamsController : ControllerBase
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user