diff --git a/packages/nocodb-sdk/src/lib/globals.ts b/packages/nocodb-sdk/src/lib/globals.ts index 475e4a8bd5..c440afeec8 100644 --- a/packages/nocodb-sdk/src/lib/globals.ts +++ b/packages/nocodb-sdk/src/lib/globals.ts @@ -195,6 +195,8 @@ export enum NcErrorType { TABLE_ASSOCIATED_WITH_LINK = 'TABLE_ASSOCIATED_WITH_LINK', INTEGRATION_NOT_FOUND = 'INTEGRATION_NOT_FOUND', INTEGRATION_LINKED_WITH_BASES = 'INTEGRATION_LINKED_WITH_BASES', + FORMULA_ERROR = 'FORMULA_ERROR', + PERMISSION_DENIED = 'PERMISSION_DENIED', } type Roles = OrgUserRoles | ProjectRoles | WorkspaceUserRoles; diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.ts index 5b2be22e15..1b6aa477d3 100644 --- a/packages/nocodb/src/db/BaseModelSqlv2.ts +++ b/packages/nocodb/src/db/BaseModelSqlv2.ts @@ -5745,7 +5745,7 @@ class BaseModelSqlv2 { await this.prepareNocoData(updateData, false, cookie); const pkValues = this.extractPksValues(updateData); - if (pkValues) { + if (pkValues !== null && pkValues !== undefined) { // pk is specified - by pass } else { const { where } = this._getListArgs(args); @@ -6467,7 +6467,7 @@ class BaseModelSqlv2 { if (this.model.primaryKeys.length > 1) { const pkValues = {}; for (const pk of this.model.primaryKeys) { - pkValues[pk.title] = data[pk.title] || data[pk.column_name]; + pkValues[pk.title] = data[pk.title] ?? data[pk.column_name]; } return pkValues; } else if (this.model.primaryKey) { diff --git a/packages/nocodb/src/helpers/catchError.ts b/packages/nocodb/src/helpers/catchError.ts index 328c5249f0..5c2d91c0c7 100644 --- a/packages/nocodb/src/helpers/catchError.ts +++ b/packages/nocodb/src/helpers/catchError.ts @@ -580,6 +580,14 @@ const errorHelpers: { message: 'Table is associated with a link, please remove the link first', code: 400, }, + [NcErrorType.FORMULA_ERROR]: { + message: (message: string) => `Formula error: ${message}`, + code: 400, + }, + [NcErrorType.PERMISSION_DENIED]: { + message: 'Permission denied', + code: 403, + }, }; function generateError(