Skip to content

Instantly share code, notes, and snippets.

@mkhmylife
Created May 5, 2021 08:51
Show Gist options
  • Save mkhmylife/0f6ec93b02b55752f9675633187ac6e6 to your computer and use it in GitHub Desktop.
Save mkhmylife/0f6ec93b02b55752f9675633187ac6e6 to your computer and use it in GitHub Desktop.
export interface AirtableConfig {
route: string;
base: string;
table: string;
view?: string;
filter?: string;
fields: string[];
fieldMappings?: Function;
}
export const airtableConfigs: Array<AirtableConfig> = [
{
route: "posts",
base: "app123456",
table: "Table Name",
filter: "Status = 'Published'",
fields: [
'ID',
'First Name',
'Last Name',
'Content',
],
fieldMappings: ((records: any[]) => {
return records.map( (record: any) => {
return {
id: record.ID,
name: `${record['First Name']} ${record['Last Name']}`,
content: record.Content,
}
})
}),
},
{
route: "settings",
base: "app123456",
table: "Table Name",
filter: "Status = 'Published'",
fields: [
"Key",
"Value",
],
},
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment