From 3323388b03bafcb40acfe113b32cdfd882edeb1c 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 860880baf2c54a9c6c6a3ad83b5e9e78e8819ad5 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 55f53de41281d83d37d0a15bd31d2f4cf3906c45 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 785cdea396221b62de094a96a5ef38ea1a6e15ae 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 ec28bb8c63571f481039bd304831491a92e8d67b 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" }