diff --git a/src/schema/mutations/AddBot.js b/src/schema/mutations/AddBot.js index a3fba7964..86d972b68 100644 --- a/src/schema/mutations/AddBot.js +++ b/src/schema/mutations/AddBot.js @@ -36,6 +36,7 @@ const resolve = async (parent, { bot }, context) => { products: [auxProduct] } auxTeam.bots.push(newBotClone) + userEcosystem.markModified("devTeams") break } } diff --git a/src/schema/mutations/AddTeam.js b/src/schema/mutations/AddTeam.js index 995f87c6e..73c7c6918 100644 --- a/src/schema/mutations/AddTeam.js +++ b/src/schema/mutations/AddTeam.js @@ -39,7 +39,17 @@ const resolve = async (parent, { team }, context) => { // Teams will be created on a local minio container let botsConfigurations = [] - await createContainer(team.codeName) + try { + await createContainer(team.codeName) + } catch (err) { + if (err.message !== 'Your previous request to create the named bucket succeeded and you already own it.') { + logger.error('addTeam -> Error: %s', err.stack) + throw err + } else { + logger.warn('addTeam -> %s', err.message) + } + } + let tradingBot = await copyBot(team.codeName, team.bot.codeName, team.bot.displayName, writeFileContent) botsConfigurations.push(tradingBot) let simulatorBot = await copySimulator(team.codeName, team.bot.codeName, team.bot.displayName, writeFileContent) @@ -59,6 +69,7 @@ const resolve = async (parent, { team }, context) => { } userEcosystem.devTeams.push(team) + userEcosystem.markModified("devTeams") await userEcosystem.save() return team } catch (err) { diff --git a/src/schema/mutations/DeleteTeam.js b/src/schema/mutations/DeleteTeam.js index f604bdac6..6c1fbc0f8 100644 --- a/src/schema/mutations/DeleteTeam.js +++ b/src/schema/mutations/DeleteTeam.js @@ -32,6 +32,7 @@ const resolve = async (parent, { team }, context) => { teamFound = true await deleteContainer(team.codeName) userEcosystem.devTeams.splice(i, 1) + userEcosystem.markModified("devTeams") await userEcosystem.save() break } diff --git a/src/schema/mutations/RemoveBot.js b/src/schema/mutations/RemoveBot.js index 68e093e27..83249f703 100644 --- a/src/schema/mutations/RemoveBot.js +++ b/src/schema/mutations/RemoveBot.js @@ -29,6 +29,7 @@ const resolve = async (parent, { bot }, context) => { if (auxProduct.codeName === bot.productCodeName) { removedBotClone = auxBot auxTeam.bots.splice(j, 1) + userEcosystem.markModified("devTeams") break } }