Browse Source

test: hide system createdby and lastmodifiedby

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/7455/head
mertmit 11 months ago
parent
commit
106b63da6e
  1. 1
      packages/nocodb/src/db/BaseModelSqlv2.ts
  2. 23
      packages/nocodb/tests/unit/model/tests/baseModelSql.test.ts

1
packages/nocodb/src/db/BaseModelSqlv2.ts

@ -6216,6 +6216,7 @@ function shouldSkipField(
if (fieldsSet) { if (fieldsSet) {
return !fieldsSet.has(column.title); return !fieldsSet.has(column.title);
} else { } else {
if (column.system && isCreatedOrLastModifiedByCol(column)) return true;
if (!extractPkAndPv) { if (!extractPkAndPv) {
if (!(viewOrTableColumn instanceof Column)) { if (!(viewOrTableColumn instanceof Column)) {
if ( if (

23
packages/nocodb/tests/unit/model/tests/baseModelSql.test.ts

@ -54,13 +54,6 @@ function baseModelSqlTests() {
); );
const insertedRow = (await baseModelSql.list())[0]; 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(inputData);
expect(insertedRow).to.deep.include(response); expect(insertedRow).to.deep.include(response);
@ -176,18 +169,10 @@ function baseModelSqlTests() {
const insertedRows: any[] = await baseModelSql.list(); const insertedRows: any[] = await baseModelSql.list();
await baseModelSql.bulkUpdate( await baseModelSql.bulkUpdate(
insertedRows.map( insertedRows.map(({ CreatedAt: _, UpdatedAt: __, ...row }) => ({
({ ...row,
CreatedAt: _, Title: `new-${row['Title']}`,
UpdatedAt: __, })),
CreatedBy: ___,
UpdatedBy: ____,
...row
}) => ({
...row,
Title: `new-${row['Title']}`,
}),
),
{ cookie: request }, { cookie: request },
); );

Loading…
Cancel
Save