diff --git a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts index 23fa267665..b738a5b26b 100644 --- a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts +++ b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts @@ -2161,7 +2161,7 @@ class BaseModelSqlv2 { let noOfDeletedRecords = data; if (!isBulkAllOperation) { noOfDeletedRecords = data.length; - await this.handleHooks('after.delete', data, null, req); + await this.handleHooks('after.delete', null, data, req); } await Audit.insert({ @@ -2256,7 +2256,7 @@ class BaseModelSqlv2 { ip: req?.clientIp, user: req?.user?.email, }); - await this.handleHooks('after.delete', data, null, req); + await this.handleHooks('after.delete', null, data, req); } private async handleHooks(hookName, prevData, newData, req): Promise { diff --git a/packages/nocodb/src/lib/meta/helpers/populateSamplePayload.ts b/packages/nocodb/src/lib/meta/helpers/populateSamplePayload.ts index 96a7591d91..8d13135f15 100644 --- a/packages/nocodb/src/lib/meta/helpers/populateSamplePayload.ts +++ b/packages/nocodb/src/lib/meta/helpers/populateSamplePayload.ts @@ -94,10 +94,8 @@ export async function populateSamplePayloadV2( samplePayload.data = { ...samplePayload.data, - ...(prevRows && { - [operation === 'delete' ? 'deleted_rows' : 'previous_rows']: [prevRows], - }), - ...(operation !== 'delete' && rows && { rows: [rows] }), + ...(prevRows && { previous_rows: [prevRows] }), + ...(rows && { rows: [rows] }), }; return samplePayload; diff --git a/packages/nocodb/src/lib/meta/helpers/webhookHelpers.ts b/packages/nocodb/src/lib/meta/helpers/webhookHelpers.ts index 9dda9fc594..49b3b944eb 100644 --- a/packages/nocodb/src/lib/meta/helpers/webhookHelpers.ts +++ b/packages/nocodb/src/lib/meta/helpers/webhookHelpers.ts @@ -149,9 +149,7 @@ export function constructWebHookData(hook, model, view, prevData, newData) { view_id: view.id, view_name: view.title, ...(prevData && { - [hook.operation === 'delete' ? 'deleted_rows' : 'previous_rows']: [ - prevData, - ], + previous_rows: [prevData], }), ...(newData && { rows: [newData] }), },