From 2f9a441d51598f6664a099974755ca038739358d Mon Sep 17 00:00:00 2001 From: Anthony Benites <104385099+ec2sw@users.noreply.github.com> Date: Wed, 27 Jul 2022 08:27:49 -0400 Subject: [PATCH] fix: fix author column in audit table --- src/tasks/sync-audit-table.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/tasks/sync-audit-table.js b/src/tasks/sync-audit-table.js index dc5d75df..ccd2a418 100644 --- a/src/tasks/sync-audit-table.js +++ b/src/tasks/sync-audit-table.js @@ -110,20 +110,22 @@ const syncOrganizationAudit = async (organization) => { // 0x636f6d6d656e74 is hex for 'comment' const comment = kvDiff.filter( (diff) => - diff.key === '636f6d6d656e74' || diff.key === '0x636f6d6d656e74', + (diff.key === '636f6d6d656e74' || diff.key === '0x636f6d6d656e74') && + diff.type === 'INSERT', ); // 0x617574686F72 is hex for 'author' const author = kvDiff.filter( (diff) => - diff.key === '617574686F72' || diff.key === '0x617574686F72', + (diff.key === '617574686f72' || diff.key === '0x617574686F72') && + diff.type === 'INSERT', ); await Promise.all( kvDiff.map(async (diff) => { const key = decodeHex(diff.key); const modelKey = key.split('|')[0]; - if (key !== 'comment') { + if (!['comment', 'author'].includes(key)) { Audit.create({ orgUid: organization.orgUid, registryId: organization.registryId,