From 40470703fe1abdce21dc02b8e98f3532d6293370 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Thu, 23 Mar 2023 19:15:35 +0800 Subject: [PATCH] feat(nocodb): enrich deleted_rows --- packages/nocodb/src/lib/meta/helpers/webhookHelpers.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/nocodb/src/lib/meta/helpers/webhookHelpers.ts b/packages/nocodb/src/lib/meta/helpers/webhookHelpers.ts index 316e13139c..adfb1739ce 100644 --- a/packages/nocodb/src/lib/meta/helpers/webhookHelpers.ts +++ b/packages/nocodb/src/lib/meta/helpers/webhookHelpers.ts @@ -146,8 +146,12 @@ export function constructWebHookData(hook, model, view, prevData, newData) { table_name: model.title, view_id: view.id, view_name: view.title, - ...(prevData && { previous_rows: prevData }), - rows: [newData], + ...(prevData && { + [hook.operation === 'delete' ? 'deleted_rows' : 'previous_rows']: [ + prevData, + ], + }), + ...(newData && { rows: [newData] }), }, }; }