Adding access code and minor fixes

This commit is contained in:
Matias committed 2019-06-17 20:47:36 -03:00
1 parent 7e51bf8e9b
commit 202265009d
7 files changed
+63 -33

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
.vs/**
obj/**
bin/**
*.config
*.log
*.cache
.env*
\.vscode/
Project.njsproj
coverage/
.nyc_output/
+1 -1
View File
@@ -1,4 +1,4 @@
FROM node:8.6-alpine
FROM node:8.16-alpine
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
+31 -25
View File
@@ -13,7 +13,7 @@ exports.newFileStorage = function newFileStorage() {
function getTextFile(container, filePath, callBackFunction) {
try {
if (INFO_LOG === true) { console.log('[INFO] getTextFile -> getBlobToText -> Entering function: ' + filePath) }
if (INFO_LOG === true) { console.log('[INFO] getTextFile -> Entering function: ' + filePath) }
axios({
url: process.env.HOST_URL + 'graphql',
@@ -47,20 +47,20 @@ exports.newFileStorage = function newFileStorage() {
else
callBackFunction(global.CUSTOM_FAIL_RESPONSE)
}).catch(error => {
if (ERROR_LOG === true) { console.log('newFileStorage: [ERROR] getTextFile -> getBlobToText -> Invalid JSON received. ') }
if (ERROR_LOG === true) { console.log('newFileStorage: [ERROR] getTextFile -> getBlobToText -> response.text = ' + error.message) }
if (ERROR_LOG === true) { console.log('newFileStorage: [ERROR] getTextFile -> Invalid JSON received. ') }
if (ERROR_LOG === true) { console.log('newFileStorage: [ERROR] getTextFile -> response.text = ' + error.message) }
callBackFunction(global.DEFAULT_FAIL_RESPONSE)
})
} catch (err) {
if (ERROR_LOG === true) { console.log('[ERROR] getTextFile -> getBlobToText -> err = ' + err.stack) }
if (ERROR_LOG === true) { console.log('[ERROR] getTextFile -> err = ' + err.stack) }
}
}
function createTextFile(container, filePath, fileContent, callBackFunction) {
async function createTextFile(container, filePath, fileContent, callBackFunction) {
try {
if (INFO_LOG === true) { console.log('[INFO] getTextFile -> createTextFile -> Entering function: ' + filePath) }
if (INFO_LOG === true) { console.log('[INFO] createTextFile -> Entering function: ' + filePath) }
axios({
let response = await axios({
url: process.env.HOST_URL + 'graphql',
method: 'post',
data: {
@@ -79,26 +79,32 @@ exports.newFileStorage = function newFileStorage() {
}
}
}
}).then(res => {
if (res.data.errors) {
let error = {
code: res.data.errors[0]
}
callBackFunction(error)
return
}
let response = res.data.data.web_CreateFile
if (response)
callBackFunction(global.DEFAULT_OK_RESPONSE)
else
callBackFunction(global.CUSTOM_FAIL_RESPONSE)
}).catch(error => {
if (ERROR_LOG === true) { console.log('newFileStorage: [ERROR] getTextFile -> getBlobToText -> Invalid JSON received. ') }
if (ERROR_LOG === true) { console.log('newFileStorage: [ERROR] getTextFile -> getBlobToText -> response.text = ' + error.message) }
callBackFunction(global.DEFAULT_FAIL_RESPONSE)
})
if(!response){
console.log('[ERROR] createTextFile -> err = ')
}
// .then(res => {
// if (res.data.errors) {
// let error = {
// code: res.data.errors[0]
// }
// callBackFunction(error)
// return
// }
// let response = res.data.data.web_CreateFile
// if (response)
// callBackFunction(global.DEFAULT_OK_RESPONSE)
// else
// callBackFunction(global.CUSTOM_FAIL_RESPONSE)
// }).catch(error => {
// if (ERROR_LOG === true) { console.log('newFileStorage: [ERROR] createTextFile -> Invalid JSON received. ') }
// if (ERROR_LOG === true) { console.log('newFileStorage: [ERROR] createTextFile -> response.text = ' + error.message) }
// callBackFunction(global.DEFAULT_FAIL_RESPONSE)
// })
} catch (err) {
if (ERROR_LOG === true) { console.log('[ERROR] createTextFile -> getBlobToText -> err = ' + err.stack) }
if (ERROR_LOG === true) { console.log('[ERROR] createTextFile -> err = ' + err.stack) }
}
}
+6 -6
View File
@@ -19,18 +19,18 @@ exports.getStrategy = async function () {
method: 'post',
data: {
query: `
query($fbSlug: String!){
strategizer_TradingSystemByFb(fbSlug: $fbSlug){
data
query($fbSlug: String!){
strategizer_TradingSystemByFb(fbSlug: $fbSlug){
data
}
}
}
`,
`,
variables: {
fbSlug: fbSlug
},
},
headers: {
access_token: process.env.ACCESS_TOKEN
access_token: process.env.ACCESS_TOKEN_STRATEGY
}
})
-1
View File
@@ -607,7 +607,6 @@
logger.write(MODULE_NAME, "[ERROR] start -> findProcess -> runIndicatorBot -> onInitializeReady -> Failed to initialize the bot. ");
console.log(logDisplace + "Root : [ERROR] start -> findProcess -> runIndicatorBot -> onInitializeReady -> err = " + err.message);
logger.persist();
throw new Error("Root -> start -> findProcess -> runIndicatorBot -> onInitializeReady -> Failed to initialize the bot.")
}
}
}
File renamed without changes.
+11
View File
@@ -18,6 +18,17 @@
"retry": "^0.12.0",
"superagent": "^5.0.2",
"underscore": "^1.9.1"
},
"dependencies": {
"axios": {
"version": "0.19.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.19.0.tgz",
"integrity": "sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ==",
"requires": {
"follow-redirects": "1.5.10",
"is-buffer": "^2.0.2"
}
}
}
},
"@superalgos/mqservice": {