fix(NocoDB Node): Fix for updating or deleting rows with not default primary keys

This commit is contained in:
Michael Kret
2023-04-12 16:27:19 +03:00
committed by GitHub
parent e79679c023
commit ee7f86394e
3 changed files with 85 additions and 42 deletions

View File

@@ -65,22 +65,65 @@ export const operationFields: INodeProperties[] = [
required: true,
description: 'The name of the table',
},
{
displayName: 'Primary Key Type',
name: 'primaryKey',
type: 'options',
default: 'id',
options: [
{
name: 'Default',
value: 'id',
description:
'Default, added when table was created from UI by those options: Create new table / Import from Excel / Import from CSV',
},
{
name: 'Imported From Airtable',
value: 'ncRecordId',
description: 'Select if table was imported from Airtable',
},
{
name: 'Custom',
value: 'custom',
description:
'When connecting to existing external database as existing primary key field is retained as is, enter the name of the primary key field below',
},
],
displayOptions: {
show: {
operation: ['delete', 'update'],
},
},
},
{
displayName: 'Field Name',
name: 'customPrimaryKey',
type: 'string',
default: '',
displayOptions: {
show: {
operation: ['delete', 'update'],
primaryKey: ['custom'],
},
},
},
{
displayName: 'Row ID Value',
name: 'id',
type: 'string',
default: '',
required: true,
description: 'The value of the ID field',
displayOptions: {
show: {
operation: ['delete', 'get', 'update'],
},
},
},
// ----------------------------------
// delete
// ----------------------------------
{
displayName: 'Row ID',
name: 'id',
type: 'string',
displayOptions: {
show: {
operation: ['delete'],
},
},
default: '',
required: true,
description: 'ID of the row to delete',
},
// ----------------------------------
// getAll
// ----------------------------------
@@ -222,19 +265,6 @@ export const operationFields: INodeProperties[] = [
// ----------------------------------
// get
// ----------------------------------
{
displayName: 'Row ID',
name: 'id',
type: 'string',
displayOptions: {
show: {
operation: ['get'],
},
},
default: '',
required: true,
description: 'ID of the row to return',
},
{
displayName: 'Download Attachments',
name: 'downloadAttachments',
@@ -265,19 +295,6 @@ export const operationFields: INodeProperties[] = [
// ----------------------------------
// update
// ----------------------------------
{
displayName: 'Row ID',
name: 'id',
type: 'string',
displayOptions: {
show: {
operation: ['update'],
},
},
default: '',
required: true,
description: 'ID of the row to update',
},
// ----------------------------------
// Shared
// ----------------------------------