feat: se centralizan las variables de entorno y utilidades, ademas de agregar entidades para poder hacer más legible el codigo
This commit is contained in:
parent
bffcdabc0a
commit
222d5fdc08
14 changed files with 203 additions and 59 deletions
|
@ -4,6 +4,7 @@ using Microsoft.Extensions.Configuration;
|
|||
using Shared.DTO;
|
||||
using Shared.DTO.Integracion_DGA;
|
||||
using Shared.Helper;
|
||||
using Shared.Utils.Variables_Entorno;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -22,13 +23,15 @@ namespace BLL.Integracion_DGA
|
|||
private readonly JobsDgaVilosRepository _jobsVilos;
|
||||
private readonly JobsDgaSupFlujRepository _jobsSupFluj;
|
||||
private readonly FileLoggerHelper _fileLoggerHelper;
|
||||
private readonly NexusApiUrl _nexusApi;
|
||||
|
||||
public BusinessLogic(IConfiguration configuration, ApiService apiService, JobsDgaRepository jobs, JobsDgaVilosRepository jobsVilos, JobsDgaSupFlujRepository jobsSupFluj) {
|
||||
public BusinessLogic(IConfiguration configuration, ApiService apiService, JobsDgaRepository jobs, JobsDgaVilosRepository jobsVilos, JobsDgaSupFlujRepository jobsSupFluj,NexusApiUrl nexusApiUrl) {
|
||||
_configuration = configuration;
|
||||
_apiService = apiService;
|
||||
_jobs = jobs;
|
||||
_jobsVilos = jobsVilos;
|
||||
_jobsSupFluj = jobsSupFluj;
|
||||
_nexusApi = nexusApiUrl;
|
||||
FileLoggerHelper.ConfigureLogger(_configuration);
|
||||
}
|
||||
|
||||
|
@ -44,11 +47,11 @@ namespace BLL.Integracion_DGA
|
|||
WriteLineAndLog($"Inicia Proceso DGA");
|
||||
try
|
||||
{
|
||||
string apiUrlBase = _configuration["ApiSettings:ApiUrl"];
|
||||
string apiUrlBase = _nexusApi.ApiUrl;
|
||||
Dictionary<string, string> headers = new Dictionary<string, string>
|
||||
{
|
||||
{ "nexustoken", _configuration["ApiSettings:ApiKey"] },
|
||||
{ "nexusapiversion", _configuration["ApiSettings:Version"] },
|
||||
{ "nexustoken", _nexusApi.ApiKey },
|
||||
{ "nexusapiversion", _nexusApi.Version },
|
||||
{ "accept", "application/json" }
|
||||
};
|
||||
|
||||
|
@ -73,8 +76,8 @@ namespace BLL.Integracion_DGA
|
|||
}
|
||||
|
||||
HistoricRequest historicRequest = new HistoricRequest();
|
||||
historicRequest.DataSource = _configuration["ApiSettings:DataSource"];
|
||||
historicRequest.Resolution = _configuration["ApiSettings:Resolution"];
|
||||
historicRequest.DataSource = _nexusApi.DataSource;
|
||||
historicRequest.Resolution = _nexusApi.Resolution;
|
||||
historicRequest.Uids = listTagsID;
|
||||
historicRequest.StartTs = dateStart.ToUnixTimeSeconds();
|
||||
historicRequest.EndTs = dateEnd.ToUnixTimeSeconds();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue