From a5065411ccc1a86a560a5579b00a55581b95871b Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Tue, 9 Aug 2022 14:55:45 +0100 Subject: [PATCH 1/5] Add table field to Airtable update --- packages/server/src/integrations/airtable.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/server/src/integrations/airtable.ts b/packages/server/src/integrations/airtable.ts index ec49bf5e40..4274cff5db 100644 --- a/packages/server/src/integrations/airtable.ts +++ b/packages/server/src/integrations/airtable.ts @@ -63,7 +63,11 @@ module AirtableModule { type: QueryTypes.FIELDS, customisable: true, fields: { - id: { + recordId: { + type: DatasourceFieldTypes.STRING, + required: true, + }, + table: { type: DatasourceFieldTypes.STRING, required: true, }, @@ -112,13 +116,13 @@ module AirtableModule { } } - async update(query: { table: any; id: any; json: any }) { - const { table, id, json } = query + async update(query: { table: any; recordId: any; json: any }) { + const { table, recordId, json } = query try { return await this.client(table).update([ { - id, + id: recordId, fields: json, }, ]) From ea6f0938da297f2c01a2954931b19514eb9828df Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Tue, 9 Aug 2022 14:59:05 +0100 Subject: [PATCH 2/5] Rename to recordID --- packages/server/src/integrations/airtable.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/server/src/integrations/airtable.ts b/packages/server/src/integrations/airtable.ts index 4274cff5db..80cfd141b0 100644 --- a/packages/server/src/integrations/airtable.ts +++ b/packages/server/src/integrations/airtable.ts @@ -63,7 +63,7 @@ module AirtableModule { type: QueryTypes.FIELDS, customisable: true, fields: { - recordId: { + recordID: { type: DatasourceFieldTypes.STRING, required: true, }, @@ -116,13 +116,13 @@ module AirtableModule { } } - async update(query: { table: any; recordId: any; json: any }) { - const { table, recordId, json } = query + async update(query: { table: any; recordID: any; json: any }) { + const { table, recordID, json } = query try { return await this.client(table).update([ { - id: recordId, + id: recordID, fields: json, }, ]) From 15fe3650dcb7d4af43e0fd44d0e64cd2c93c9242 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Tue, 9 Aug 2022 15:54:08 +0100 Subject: [PATCH 3/5] Fix unit test --- packages/server/src/integrations/tests/airtable.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server/src/integrations/tests/airtable.spec.js b/packages/server/src/integrations/tests/airtable.spec.js index 4769430ded..e415fa1081 100644 --- a/packages/server/src/integrations/tests/airtable.spec.js +++ b/packages/server/src/integrations/tests/airtable.spec.js @@ -48,8 +48,8 @@ describe("Airtable Integration", () => { it("calls the update method with the correct params", async () => { const response = await config.integration.update({ - table: "test", - id: "123", + table: "table", + recordID: "123", json: { name: "test" } From ba4b20bb62ccc2b93d7c46585a5a3d81fc447246 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Wed, 10 Aug 2022 13:54:56 +0100 Subject: [PATCH 4/5] Use display field --- packages/server/src/integrations/airtable.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/server/src/integrations/airtable.ts b/packages/server/src/integrations/airtable.ts index 80cfd141b0..eaf4317953 100644 --- a/packages/server/src/integrations/airtable.ts +++ b/packages/server/src/integrations/airtable.ts @@ -63,7 +63,8 @@ module AirtableModule { type: QueryTypes.FIELDS, customisable: true, fields: { - recordID: { + id: { + display: "Record ID", type: DatasourceFieldTypes.STRING, required: true, }, @@ -116,13 +117,13 @@ module AirtableModule { } } - async update(query: { table: any; recordID: any; json: any }) { - const { table, recordID, json } = query + async update(query: { table: any; id: any; json: any }) { + const { table, id, json } = query try { return await this.client(table).update([ { - id: recordID, + id, fields: json, }, ]) From 69ee22f5636b2304bd20552544a2675037ebb821 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Wed, 10 Aug 2022 13:56:15 +0100 Subject: [PATCH 5/5] Fix unit test --- packages/server/src/integrations/tests/airtable.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/src/integrations/tests/airtable.spec.js b/packages/server/src/integrations/tests/airtable.spec.js index e415fa1081..df676a1397 100644 --- a/packages/server/src/integrations/tests/airtable.spec.js +++ b/packages/server/src/integrations/tests/airtable.spec.js @@ -49,7 +49,7 @@ describe("Airtable Integration", () => { it("calls the update method with the correct params", async () => { const response = await config.integration.update({ table: "table", - recordID: "123", + id: "123", json: { name: "test" }