Using default key

This commit is contained in:
Unknown committed 2019-02-19 04:03:05 +01:00
1 parent fbde934d78
commit 21572c3a2a
1 file changed
+45 -24
+45 -24
View File
@@ -58,18 +58,8 @@ const resolve = (parent,
method: 'post',
data: {
query: `
mutation {
operations_AddClone(
clone: {
botId: "${botId}"
botType: "Trading"
mode: "competition"
resumeExecution: false
runAsTeam: true
teamId: "${participantId}"
processName: "${event.title}-${participantId}"
}
) {
{
keyVault_DefaultKey{
id
}
}
@@ -77,18 +67,49 @@ const resolve = (parent,
},
headers: { authorization },
}).then(
(operationCreation) => {
event.participants.push({
participantId,
operationId: operationCreation.data.data.operations_AddClone.id,
});
event.save((error) => {
if (error) {
rej(error);
return;
}
res(event);
});
(keyResult) => {
axios({
url: process.env.GATEWAY_ENDPOINT,
method: 'post',
data: {
query: `
mutation {
operations_AddClone(
clone: {
botId: "${botId}"
botType: "Trading"
mode: "competition"
resumeExecution: false
runAsTeam: true
teamId: "${participantId}"
processName: "${event.title}-${participantId}"
keyId: "${keyResult.data.data.keyVault_DefaultKey.id}"
}
) {
id
}
}
`,
},
headers: { authorization },
}).then(
(operationCreation) => {
event.participants.push({
participantId,
operationId: operationCreation.data.data.operations_AddClone.id,
});
event.save((error) => {
if (error) {
rej(error);
return;
}
res(event);
});
},
(error) => {
rej(new ServiceUnavailableError(error));
},
);
},
(error) => {
rej(new ServiceUnavailableError(error));