π₯ π₯ π₯ A Free & Self-hostable Airtable Alternative
TypeScript airtableairtable-alternativeautomatic-apihacktoberfestlow-codeno-codeno-code-databaseno-code-platformpostgresqlrest-apirestful-apispreadsheetsqliteswagger
fix: data bulk operation audit corrections
Pranav Cd868b70872b9
diff --git a/packages/nc-gui/components/smartsheet/expanded-form/Sidebar/Audits.vue b/packages/nc-gui/components/smartsheet/expanded-form/Sidebar/Audits.vueindex 5b752799d2..433501a3a9 100644--- a/packages/nc-gui/components/smartsheet/expanded-form/Sidebar/Audits.vue+++ b/packages/nc-gui/components/smartsheet/expanded-form/Sidebar/Audits.vue@@ -166,7 +166,7 @@ function isV0Audit(audit: AuditType) {{{ audit.description }}</div></div>- <div v-else-if="audit?.op_type === 'DATA_INSERT'" class="pl-9">created the record.</div>+ <div v-else-if="['DATA_INSERT', 'DATA_BULK_INSERT'].includes(audit?.op_type)" class="pl-9">created the record.</div><div v-else-if="['DATA_LINK', 'DATA_UNLINK'].includes(audit?.op_type)" class="pl-9"><div class="rounded-lg border-1 border-nc-border-gray-medium bg-nc-bg-gray-extralight divide-y py-2 px-3"><div class="flex items-center gap-2 !text-nc-content-gray-subtle2 text-xs nc-audit-mini-item-header mb-3">@@ -204,7 +204,7 @@ function isV0Audit(audit: AuditType) {</div></div></div>- <template v-else-if="audit?.op_type === 'DATA_UPDATE'">+ <template v-else-if="['DATA_UPDATE', 'DATA_BULK_UPDATE', 'DATA_BULK_ALL_UPDATE'].includes(audit?.op_type)"><div class="ml-9 rounded-lg border-1 border-nc-border-gray-medium bg-nc-bg-gray-extralight divide-y"><SmartsheetExpandedFormSidebarAuditMiniItem :audit="audit" /></div>diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.tsindex 4b32cac35e..91ee4dda4a 100644--- a/packages/nocodb/src/db/BaseModelSqlv2.ts+++ b/packages/nocodb/src/db/BaseModelSqlv2.ts@@ -7000,6 +7000,17 @@ class BaseModelSqlv2 implements IBaseModelSqlV2 {const auditUpdateObj = [];for (const rowId of rowIds) {+ const prevData = typeof rowId === 'object' ? rowId : {};+ const updateDiff = populateUpdatePayloadDiff({+ keepUnderModified: true,+ prev: prevData,+ next: data,+ exclude: extractExcludedColumnNames(this.model.columns),+ excludeNull: false,+ excludeBlanks: false,+ keepNested: true,+ }) as UpdatePayload;+auditUpdateObj.push(await generateAuditV1Payload<DataBulkUpdateAllPayload>(AuditV1OperationTypes.DATA_BULK_ALL_UPDATE,@@ -7011,13 +7022,14 @@ class BaseModelSqlv2 implements IBaseModelSqlV2 {row_id: this.extractPksValues(rowId, true),},details: {- data: removeBlankPropsAndMask(data, ['CreatedAt', 'UpdatedAt']),- old_data: removeBlankPropsAndMask(rowId, [- 'CreatedAt',- 'UpdatedAt',- ]),+ old_data: updateDiff.previous_state,+ data: updateDiff.modifications,conditions: conditions,- column_meta: extractColsMetaForAudit(this.model.columns, data),+ column_meta: extractColsMetaForAudit(+ this.model.columns,+ data,+ prevData,+ ),},req,},