From fc1850179a2e6e2fd6005b2af132d129607a76c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=20Lis=C3=A9?= Date: Tue, 11 Jun 2024 13:18:28 -0700 Subject: [PATCH] NOBUG: Update conditions (#401) --- lambda/dynamoUtil.js | 6 ++++-- lambda/writePass/index.js | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lambda/dynamoUtil.js b/lambda/dynamoUtil.js index aed6933f..d36105da 100644 --- a/lambda/dynamoUtil.js +++ b/lambda/dynamoUtil.js @@ -520,7 +520,8 @@ async function restoreAvailablePass(pk, sk, orcNumber, shortPassDate, facilityNa Key: { pk: { S: pk }, sk: { S: sk } - } + }, + ConditionExpression: 'attribute_exists (pk) AND attribute_exists (sk)' } }, { @@ -529,7 +530,8 @@ async function restoreAvailablePass(pk, sk, orcNumber, shortPassDate, facilityNa Key: { pk: { S: passPk }, sk: { S: passSk } - } + }, + ConditionExpression: 'attribute_exists (pk) AND attribute_exists (sk)' } }] }; diff --git a/lambda/writePass/index.js b/lambda/writePass/index.js index 812ff36a..939763bc 100644 --- a/lambda/writePass/index.js +++ b/lambda/writePass/index.js @@ -488,7 +488,7 @@ async function transactWriteWithRetries(transactionObj, maxRetries = 3) { cancellationReasons = cancellationReasons.slice(0, -1); cancellationReasons = cancellationReasons.split(', '); let message = error.message; - let reasonIndex = this.cancellationReasons.findIndex((i) => i !== 'None'); + let reasonIndex = cancellationReasons.findIndex((i) => i !== 'None'); if (reasonIndex > -1) { switch (reasonIndex) { case 0: