diff --git a/src/services/database.ts b/src/services/database.ts index c866efe3..598868e5 100644 --- a/src/services/database.ts +++ b/src/services/database.ts @@ -157,15 +157,6 @@ export const updateVehicle = async (recordsToArchive: TechRecordType<'get'>[], n const transactWriteParams: TransactWriteCommandInput = { TransactItems: [] }; - newRecords.forEach((record) => { - transactWriteParams.TransactItems?.push({ - Put: { - TableName: tableName, - Item: marshall(record, { removeUndefinedValues: true }), - }, - }); - }); - recordsToArchive.forEach((record) => { transactWriteParams.TransactItems?.push( { @@ -178,6 +169,15 @@ export const updateVehicle = async (recordsToArchive: TechRecordType<'get'>[], n ); }); + newRecords.forEach((record) => { + transactWriteParams.TransactItems?.push({ + Put: { + TableName: tableName, + Item: marshall(record, { removeUndefinedValues: true }), + }, + }); + }); + const sendTransaction = new Promise((resolve, reject) => { ddbClient.send(new TransactWriteItemsCommand(transactWriteParams)).then(() => { logger.debug('Resolving with success');