forked from ddrilling/AsbCloudServer
Remove obsolete dataService; remove db mdel dependendency from webApi
This commit is contained in:
parent
e05c291b2b
commit
91c85c8fdc
@ -18,7 +18,6 @@ namespace AsbCloudWebApi.Controllers
|
||||
[ApiController]
|
||||
public class TelemetryController : ControllerBase
|
||||
{
|
||||
private readonly IDataService DataService;
|
||||
private readonly ITelemetryService telemetryService;
|
||||
private readonly IMessageService messageService;
|
||||
private readonly IEventService eventService;
|
||||
@ -28,14 +27,12 @@ namespace AsbCloudWebApi.Controllers
|
||||
|
||||
public TelemetryController(
|
||||
ITelemetryService telemetryService,
|
||||
IDataService DataService,
|
||||
IMessageService messageService,
|
||||
IEventService eventService,
|
||||
ITelemetryUserService telemetryUserService,
|
||||
IHubContext<TelemetryHub> telemetryHubContext,
|
||||
ITelemetryTracker telemetryTracker)
|
||||
{
|
||||
this.DataService = DataService;
|
||||
this.telemetryService = telemetryService;
|
||||
this.messageService = messageService;
|
||||
this.eventService = eventService;
|
||||
@ -59,31 +56,6 @@ namespace AsbCloudWebApi.Controllers
|
||||
return Ok();
|
||||
}
|
||||
|
||||
//TODO: remove when panels update will be done.
|
||||
/// <summary>
|
||||
/// Принимает данные от разных систем по скважине
|
||||
/// </summary>
|
||||
/// <param name="uid">Уникальный идентификатор отправителя</param>
|
||||
/// <param name="dtos">Данные</param>
|
||||
/// <param name="token">Токен для отмены задачи</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Obsolete]
|
||||
[Route("{uid}/data")]
|
||||
public async Task<IActionResult> PostDataAsync(string uid, [FromBody] IEnumerable<TelemetryDataSaubDto> dtos,
|
||||
CancellationToken token = default)
|
||||
{
|
||||
var idWell = telemetryService.GetidWellByTelemetryUid(uid);
|
||||
await DataService.UpdateDataAsync(uid, dtos, token).ConfigureAwait(false);
|
||||
|
||||
if (idWell != null && dtos.Any())
|
||||
await Task.Run(() => telemetryHubContext.Clients.Group($"well_{idWell}")
|
||||
.SendAsync("ReceiveDataSaub", dtos), token).ConfigureAwait(false);
|
||||
|
||||
telemetryTracker.SaveRequestDate(uid);
|
||||
return Ok();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Принимает список новых сообщений от телеметрии
|
||||
/// </summary>
|
||||
|
@ -1,4 +1,4 @@
|
||||
using AsbCloudDb.Model;
|
||||
using AsbCloudApp.Data;
|
||||
using System.Security.Claims;
|
||||
|
||||
namespace AsbCloudWebApi
|
||||
@ -7,7 +7,7 @@ namespace AsbCloudWebApi
|
||||
{
|
||||
public static int? GetCompanyId(this ClaimsPrincipal user)
|
||||
{
|
||||
var claimIdCompany = user.FindFirst(nameof(User.IdCompany));
|
||||
var claimIdCompany = user.FindFirst(nameof(UserDto.IdCompany));
|
||||
if (claimIdCompany is null)
|
||||
return null;
|
||||
|
||||
@ -18,7 +18,7 @@ namespace AsbCloudWebApi
|
||||
|
||||
public static int? GetUserId(this ClaimsPrincipal user)
|
||||
{
|
||||
var userId = user.FindFirst(nameof(User.Id));
|
||||
var userId = user.FindFirst(nameof(UserDto.Id));
|
||||
if (userId is null)
|
||||
return null;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user