From 106b63da6eab30643f3ed1971416d459667190b0 Mon Sep 17 00:00:00 2001 From: mertmit Date: Wed, 17 Jan 2024 14:48:54 +0300 Subject: [PATCH] test: hide system createdby and lastmodifiedby Signed-off-by: mertmit --- packages/nocodb/src/db/BaseModelSqlv2.ts | 1 + .../unit/model/tests/baseModelSql.test.ts | 23 ++++--------------- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.ts index 33b672eac1..509ce1d58e 100644 --- a/packages/nocodb/src/db/BaseModelSqlv2.ts +++ b/packages/nocodb/src/db/BaseModelSqlv2.ts @@ -6216,6 +6216,7 @@ function shouldSkipField( if (fieldsSet) { return !fieldsSet.has(column.title); } else { + if (column.system && isCreatedOrLastModifiedByCol(column)) return true; if (!extractPkAndPv) { if (!(viewOrTableColumn instanceof Column)) { if ( diff --git a/packages/nocodb/tests/unit/model/tests/baseModelSql.test.ts b/packages/nocodb/tests/unit/model/tests/baseModelSql.test.ts index bc9a7fdfa3..6914a22858 100644 --- a/packages/nocodb/tests/unit/model/tests/baseModelSql.test.ts +++ b/packages/nocodb/tests/unit/model/tests/baseModelSql.test.ts @@ -54,13 +54,6 @@ function baseModelSqlTests() { ); const insertedRow = (await baseModelSql.list())[0]; - inputData.CreatedBy = { - id: context.user.id, - email: context.user.email, - display_name: context.user.display_name, - }; - inputData.UpdatedBy = null; - expect(insertedRow).to.deep.include(inputData); expect(insertedRow).to.deep.include(response); @@ -176,18 +169,10 @@ function baseModelSqlTests() { const insertedRows: any[] = await baseModelSql.list(); await baseModelSql.bulkUpdate( - insertedRows.map( - ({ - CreatedAt: _, - UpdatedAt: __, - CreatedBy: ___, - UpdatedBy: ____, - ...row - }) => ({ - ...row, - Title: `new-${row['Title']}`, - }), - ), + insertedRows.map(({ CreatedAt: _, UpdatedAt: __, ...row }) => ({ + ...row, + Title: `new-${row['Title']}`, + })), { cookie: request }, );