Fixing create and delete teams

This commit is contained in:
Matias committed 2019-04-10 10:02:57 +02:00
1 parent 34fe118ecc
commit 3bef93ed45
2 files changed
+23 -26

No files matched your search

+5 -5
View File
@@ -106,23 +106,23 @@ exports.newCopySimulator = function newCopySimulator(pStorage) {
async function getFileContent(containerName, blobName) {
storage.readData[util.promisify.custom] = n => new Promise((resolve, reject) => {
storage.readData(pOrg, pPath, pFile, saveAtCache, (err, pFileContent) => {
storage.readData("AATemplate", containerName, blobName, false, (err, pFileContent) => {
if (err.result !== global.DEFAULT_OK_RESPONSE.result) {
reject(err)
} else {
resolve(JSON.parse(pFileContent))
resolve(pFileContent)
}
})
})
let readData = util.promisify(storage.readData)
let fileContent = await readData("AATemplate", containerName, blobName, false)
let fileContent = await readData()
return fileContent
}
async function writeFileContent(teamName, containerName, blobName, content) {
storage.writeData[util.promisify.custom] = n => new Promise((resolve, reject) => {
storage.writeData(pOrg, pPath, pFile, pFileContent, (err, value) => {
storage.writeData(teamName, containerName, blobName, content, (err, value) => {
if (err.result !== global.DEFAULT_OK_RESPONSE.result) {
reject(err)
} else {
@@ -132,7 +132,7 @@ exports.newCopySimulator = function newCopySimulator(pStorage) {
})
let writeData = util.promisify(storage.writeData)
let response = await writeData(teamName, containerName, blobName, content)
let response = await writeData()
return response
}
+18 -21
View File
@@ -6,16 +6,13 @@
initialize: initialize
}
let masterAppServerURL;
let storage;
let masterAppServerURL, storage
return thisObject;
function initialize(pServerConfig, pStorage) {
storage = pStorage;
masterAppServerURL = pServerConfig.masterAppServerURL
storage = pStorage
}
function newTeam(pTeamCodeName, pTeamDisplayName, pUserName, pBotCodeName, pBotDisplayName, pUserId, callBackFunction) {
@@ -599,19 +596,19 @@
}
}
`, variables, function (req, res) {
if (res.status === 401) {
console.log('[ERROR] TeamSetup -> newTeam -> Error trying to save the session token at the Users Module');
console.log('[ERROR] TeamSetup -> newTeam -> res.status = 401');
}
}).then(res => {
if (res.errors) {
console.log('[ERROR] TeamSetup -> newTeam -> Error trying to save the session token at the Users Module');
console.log('[ERROR] TeamSetup -> newTeam -> res.errors = ' + res.errors);
}
}).catch(error => {
console.log('Error trying to save the session token at the Users Module');
console.log('[ERROR] TeamSetup -> newTeam -> errors = ' + errors);
});
if (res.status === 401) {
console.log('[ERROR] TeamSetup -> newTeam -> Error trying to save the session token at the Users Module');
console.log('[ERROR] TeamSetup -> newTeam -> res.status = 401');
}
}).then(res => {
if (res.errors) {
console.log('[ERROR] TeamSetup -> newTeam -> Error trying to save the session token at the Users Module');
console.log('[ERROR] TeamSetup -> newTeam -> res.errors = ' + res.errors);
}
}).catch(error => {
console.log('Error trying to save the session token at the Users Module');
console.log('[ERROR] TeamSetup -> newTeam -> errors = ' + errors);
});
} catch (err) {
@@ -656,7 +653,7 @@
"configFile": "this.bot.config.json"
},
{
"repo": "simulator-"+ pBotCodeName + "-Indicator-Bot",
"repo": "simulator-" + pBotCodeName + "-Indicator-Bot",
"configFile": "this.bot.config.json"
}
],
@@ -836,7 +833,7 @@
}
// TODO Fix-Me: this method is trying to remove from the container that was removed by the previous method.
// TODO Fix-Me: this method is trying to remove from the container that was removed by the previous method.
// It must remove the files from the aaplatform/team-name folder instead
function deleteBotConfig() {